Java ReentrantReadWriteLocks - how to safely acquire write lock?

前端 未结 12 1752
小蘑菇
小蘑菇 2020-11-28 19:00

I am using in my code at the moment a ReentrantReadWriteLock to synchronize access over a tree-like structure. This structure is large, and read by many threads at once wit

12条回答
  •  伪装坚强ぢ
    2020-11-28 19:18

    Java 8 now has a java.util.concurrent.locks.StampedLock with a tryConvertToWriteLock(long) API

    More info at http://www.javaspecialists.eu/archive/Issue215.html

提交回复
热议问题