Package org.opennms.netmgt.alarmd
Class StripedExt
- java.lang.Object
-
- org.opennms.netmgt.alarmd.StripedExt
-
public class StripedExt extends java.lang.Object
Here we extendStriped
to support creating fair reentrant locks. We use reflection to invokeCompactStriped(int, Supplier)
and provide a supplier that creates a fair lock. This is clearly a hack, but seems better than the alternative of A) trying to find another library that supports this or B) re-implementing striped locking ourselves. Guava Feature Request: https://github.com/google/guava/issues/2514- Author:
- jwhite
-
-
Constructor Summary
Constructors Constructor Description StripedExt()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static com.google.common.util.concurrent.Striped<java.util.concurrent.locks.Lock>
fairLock(int stripes)
Creates aStriped<Lock>
with eagerly initialized, strongly referenced locks.
-
-
-
Method Detail
-
fairLock
public static com.google.common.util.concurrent.Striped<java.util.concurrent.locks.Lock> fairLock(int stripes)
Creates aStriped<Lock>
with eagerly initialized, strongly referenced locks. Every lock is fair and reentrant.- Parameters:
stripes
- the minimum number of stripes (locks) required- Returns:
- a new
Striped<Lock>
-
-