方法
| 描述
|
void acquire(int arg)
| 获取独占锁。会调用 tryAcquire 方法,如果未获取成功,则会进入同步队列等待
|
void acquireInterruptibly(int arg)
| 响应停止版本的 acquire
|
boolean tryAcquireNanos(int arg,long nanos)
| 响应停止+带超时版本的 acquire
|
void acquireShared(int arg)
| 获取共享锁。会调用 tryAcquireShared 方法
|
void acquireSharedInterruptibly(int arg)
| 响应停止版本的 acquireShared
|
boolean tryAcquireSharedNanos(int arg,long nanos)
| 响应停止+带超时版本的 acquireShared
|
boolean release(int arg)
| 开释独占锁
|
boolean releaseShared(int arg)
| 开释共享锁
|
Collection getQueuedThreads()
| 获取同步队列上的线程集合
|
源码层面上会对acquire、release、acquireShared 、releaseShared 进行详解