AQS UML类图
2023-03-24 16:43:54 8 举报
AQS UML类图
作者其他创作
大纲/内容
ReadWriteLockView
+ readLock():Lock+ writeLock():Lock
内部类
ReentrantReadWriteLock.NonfairSync
* writerShouldBlock():boolean* readerShouldBlock():boolean
基于JDK1.8
Semaphore.NonfairSync
* NonfairSync(int permits)# tryAcquireShared(int acquires):int
Semaphore.FairSync
* FairSync(int permits)# tryAcquireShared(int acquires):int
CountDownLatch.Sync
* Sync(int count)* getCount():int# tryAcquireShared(int acquires):int# tryReleaseShared(int releases):boolean
AbstractQueuedSynchronizer
- head:Node- tail:Node- state:int- unsafe:Unsafe
Semaphore
- sync:Sync
+ Semaphore(int permits)+ acquire():void+ release():void
ReadLock
- sync:Sync
+ lock():void+ lockInterruptibly():void+ unlock():void+ tryLock():booleanfont color=\"#323232\
+ 公有(public)# 保护(span style=\
ConditionObject
- firstWaiter:Node- lastWaiter:Node- REINTERRUPT:int=1- THROW_IE:int=-1
+ await():void+ signal():void- doSignal(Node first):void- addConditionWaiter():Node
ReentrantReadWriteLock.FairSync
* writerShouldBlock():boolean* readerShouldBlock():boolean
ReadLockView
继承
实现
<<interface>>Condition
+ await():void+ signal():void
ReentrantLock
WriteLockView
WriteLock
ReentrantLock.Sync
* lock():void* isLocked():boolean* newCondition():ConditionObject* nonfairTryAcquire(int acquires):boolean# tryRelease(int releases):boolean# isHeldExclusively():boolean
CountDownLatch
+ CountDownLatch(int count)+ await():void+ countDown():void+ getCount():long
ReentrantLock.FairSync
* lock():void# tryAcquire(int acquires):boolean
ReentrantLock.NonfairSync
StampedLock
* readLockView:ReadLockView * writeLockView:WriteLockView* readWriteLockView:ReadWriteLockView
Node
* SHARED:Node=new Node()* EXCLUSIVE:Node=null* CANCELLED:int=1* SIGNAL:int=-1* CONDITION:int=-2* PROPAGATE:int=-3* waitStatus:int* prev:Node* next:Node* thread:Thread
* isShared():boolean* predecessor():Node
ReentrantReadWriteLock
- readerLock:ReentrantReadWriteLock.ReadLock- writerLock:ReentrantReadWriteLock.WriteLock
+ readLock():ReentrantReadWriteLock.ReadLock+ writeLock():ReentrantReadWriteLock.WriteLock
Semaphore.Sync
* Sync(int permits)* getPermits():int* drainPermits():int* nonfairTryAcquireShared(int acquires):int* reducePermits(int reductions):void# tryReleaseShared(int releases):boolean
<<interface>>Lock
<<interface>>ReadWriteLock
ReentrantReadWriteLock.Sync
* tryReadLock():boolean* tryWriteLock():boolean# tryAcquire(int acquires):boolean# tryAcquireShared(int unused):int# tryRelease(int releases):boolean# tryReleaseShared(int unused):boolean
AbstractOwnableSynchronizer
- exclusiveOwnerThread:Thread
# setExclusiveOwnerThread(Thread thread):void# Thread getExclusiveOwnerThread():Thread
0 条评论
下一页