1.java.util.concurrent.locks包里面的主要接口Lock,Condition,ReadWriteLock,主要的类为ReentrantLock,ReentrantReadWriteLock,ReentrantReadWriteLock.ReadLock,ReentrantReadWriteLock.WriteLock,LockSupport
2.ReentrantLock里面的主要方法为:lock(),unlock(),tryLock(),lockInterruptibly(),newCondition(),isHeldByCurrentThread(),isLocked();
isFair(),hasQueuedThread(),getOwner(),getQueuedThreads();
3.Condition里面的主要方法为await(),signal(),signalAll();
4.ReentrantReadWriteLock里面的主要方法为:readLock(),WriteLock();
5.LockSupport里面的主要方法为:park(),unpark();
LockSupport.park(Thread t) :Disables the current thread for thread scheduling purposes unless the permit is available.
LockSupprt.unpark(Thread t):Makes available the permit for the given thread, if it was not already available.
时间: 2024-10-12 12:40:10