Package org.infinispan.container.offheap
Class StripedLock
java.lang.Object
org.infinispan.container.offheap.StripedLock
Holder for stamped locks that provides ability to retrieve them by offset and hashCode
Note that locks protect entries
- Since:
- 9.0
- Author:
- wburns
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetLockWithOffset
(int offset) Retrieves the given lock at a provided offset.void
lockAll()
Locks all write locks.
-
Constructor Details
-
StripedLock
public StripedLock(int lockCount)
-
-
Method Details
-
getLockWithOffset
Retrieves the given lock at a provided offset. Note this is not hashCode based. This method requires care and the knowledge of how many locks there are. This is useful when iterating over all locks- Parameters:
offset
- the offset of the lock to find- Returns:
- the lock at the given offset
-
lockAll
public void lockAll()Locks all write locks. Ensure thatunlockAll()
is called in a proper finally block
-