1、ReentrantLock
lock()获取锁,unlock()取得锁
Condition:可以实现多路通知,选择性的的通知,比synchronized的效率高
signal() ==》 notify() ;
signalAll() ==》 notifyAll()
await() ==》 wait()
调用await()前必须先lock()
公平锁:线程按照FIFO的规则来获得锁 new ReentrantLock(true) 非公平锁:随机获得锁 new ReentrantLock(false),此为默认
相关的API的要掌握,tryLock()等。
2、ReentrantReadWriteLock
读读共享,读写互斥,写读互斥