Package org.forgerock.bloomfilter
Enum Class ConcurrencyStrategy
- All Implemented Interfaces:
Serializable,Comparable<ConcurrencyStrategy>,java.lang.constant.Constable
Strategy that determines how thread-safety of bloom filters should be managed. Different strategies have different
trade-offs in terms of memory usage and read or write performance.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionUses atomic compare-and-set (CAS) instructions to implement BloomFilter operations over AtomicLongArrays.Treats Bloom Filters as effectively immutable objects and creates a copy when applying updates before atomically swapping with the original.Fully synchronizes all accesses to the bloom filter. -
Method Summary
Modifier and TypeMethodDescriptionstatic ConcurrencyStrategyReturns the enum constant of this class with the specified name.static ConcurrencyStrategy[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
COPY_ON_WRITE
Treats Bloom Filters as effectively immutable objects and creates a copy when applying updates before atomically swapping with the original. This strategy optimises read (mightContain) performance at the cost of significantly more expensive write (add/addAll) times and increased garbage collection pressure due to the temporary copies that are created. This is the recommended strategy if read performance is critical. Writing batching can be used to mitigate the poor write performance (even exceeding the synchronized strategy) and somewhat mitigate the additional garbage creation. -
SYNCHRONIZED
Fully synchronizes all accesses to the bloom filter. For scalable and rolling bloom filters, each bucket in the chain is synchronized individually, allowing a finer level of locking. This strategy provides a reasonable compromise between read and write performance when read performance is not critical. Additionally, this strategy creates significantly less garbage collection pressure than the copy-on-write strategy as it modifies bloom filters in-place. -
ATOMIC
Uses atomic compare-and-set (CAS) instructions to implement BloomFilter operations over AtomicLongArrays. This strategy offers excellent performance for reads and writes with less garbage collection pressure than the Copy on Write strategy and comparable performance to that strategy even with write batching.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-