码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2016-10-17 14:31:21      阅读:201      评论:0      收藏:0      [点我收藏+]

标签:

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.

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

标签:

原文地址:http://www.cnblogs.com/fengfengtk/p/5969311.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!