ReentrantLock与AQS
2021-07-27 13:53:40 17 举报
ReentrantLock与AQS类图详解
作者其他创作
大纲/内容
ReentrantLock.Sync
lock()nonfairTryAcquire(int acquires)newCondition():ConditionObjectgetOwner():ThreadgetHoldCount():intisLocked():boolean
AbstractOwnableSynchronizer
- exclusiveOwnerThread:Thread
AbstractQueuedSynchronizer.Node
waitStatus:intprev:Nodenext:Nodethread:ThreadnextWaiter:Node
predecessor():NodeisShared():boolean
Lock
ReentrantLock
- sync:Sync
+ ReentrantLock()+ ReentrantLock(boolean fair)+ getHoldCount():int+ isHeldByCurrentThread():boolean+ isLocked():boolean+ isFair():boolean+ hasQueuedThreads():boolean+ hasQueuedThread(Thread thread):boolean+ getQueueLength():int+ hasWaiters(Condition condition):boolean+ getWaitQueueLength(Condition condition):int
AbstractQueuedSynchronizer
- head:Node- tail:Node- state:int
ReentrantLock.NonfairSync
ReentrantLock.FairSync
Condition
AbstractQueuedSynchronizer.ConditionObject
- firstWaiter:Node- lastWaiter:Node
+ operation1(params):returnType- addConditionWaiter():Node- doSignal(Node first)- doSignalAll(Node first)- unlinkCancelledWaiters()- checkInterruptWhileWaiting(Node node)- reportInterruptAfterWait(int interruptMode)isOwnedBy(AbstractQueuedSynchronizer sync):boolean# hasWaiters():boolean# getWaitQueueLength():int# getWaitingThreads():Collection<Thread>
0 条评论
下一页