Why ConcurrentHashMap cannot be locked for exclusive access?

后端 未结 3 1683
旧巷少年郎
旧巷少年郎 2021-01-21 02:31

A quote from #JCIP :

\"Since a ConcurrentHashMap cannot be locked for exclusive access, we cannot use client-side locking to create new atomic operatio

3条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-21 03:14

    Why? Because the implementation does not support it. Straight from the ConcurrentHashMap JavaDocs:

    There is not any support for locking the entire table in a way that prevents all access

    ...which is, by definition, "exclusive access."

提交回复
热议问题