Java multi-threaded programming (4) the use of Lock

  1. Use the ReentrantLock class

  1. Synchronization using ReentrantLock: Test 1

  2. Synchronization using ReentrantLock: Test 2

  3. Use Condition to achieve wait/notify error usage and resolution

  4. Correct use of Condition to achieve waiting/notification

  5. Using multiple Conditions to implement notification part of the thread: wrong usage

  6. Use multiple Conditions to implement notification part of the thread: correct usage

  7. Implement the producer/consumer pattern: one-to-one alternate printing

  8. Implement the producer/consumer model: many-to-many alternate printing

  9. Fair lock and unfair lock

  10. Test of methods getHoldCount(), getQueueLength(), getWaitQueueLength()

  11. Test of methods hasQueuedThread(), hasQueuedThreads(), hasWaiters()

  12. Test of methods isFair(), isHeldByCurrentThread(), isLocked()

  13. Test of methods lockInterruptibly(), tryLock(), tryLock(long timeout, TimeUnit unit)

  14. The use of the method awaitUninterruptibly()

  15. Use of method awaitUntil()

  16. Use Condition to achieve sequential execution

  Second, use the ReentrantReadWriteLock class

  1. Use of class ReentrantReadWriteLock: read and read sharing

  2. The use of the class ReentrantReadWriteLock: write and write mutual exclusion

  3. The use of the class ReentrantReadWriteLock: read and write mutual exclusion

  4. Use of class ReentrantReadWriteLock: write and read mutual exclusion

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325272274&siteId=291194637