java多线程常见类与方法之java.util.concurrent.locks

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.

posted @ 2016-10-17 12:07  天空中的蜂蜂  阅读(1284)  评论(0编辑  收藏  举报