See: Description
Interface | Description |
---|---|
BloomFilter<E> |
General interface contract for implementations of Bloom
Filters.
|
ExpiryStrategy<T> |
Strategy pattern for determining when elements added to a
ConcurrentRollingBloomFilter should expire. |
Class | Description |
---|---|
BloomFilters |
Factory methods for creating bloom filters with various requirements.
|
BloomFilters.BloomFilterBuilder<T> |
Builder for constructing and configuring Bloom Filter implementations.
|
BloomFilters.RollingBloomFilterBuilder<T> |
Builder pattern for Rolling Bloom Filters, which are Scalable Bloom Filters whose elements can expire allowing
space to be reclaimed over time.
|
BloomFilters.ScalableBloomFilterBuilder<T> |
Builder pattern for Scalable Bloom Filters.
|
BloomFilterStatistics |
Provides a snapshot of the current statistics and configuration of a Bloom Filter implementation.
|
ConcurrentRollingBloomFilter<T> |
A thread-safe implementation of a Bloom Filter that can expand over time to accommodate arbitrary numbers of
elements, while also allowing old elements to be deleted after they have expired.
|
Enum | Description |
---|---|
ConcurrencyStrategy |
Strategy that determines how thread-safety of bloom filters should be managed.
|
BloomFilter
interface describes the general contract of bloom filters in
more detail, and the BloomFilters
utility class provides static factory and
builder methods for constructing bloom filters for various requirements.
BloomFilter<CharSequence> blacklistedSessions = BloomFilters.create(Funnels.stringFunnel(UTF8))
.withInitialCapacity(10000) // Initial size
.withCapacityGrowthFactor(2.0) // Double size when full
.withFalsePositiveProbability(0.01) // 1% probability of false positives
.withWriteBatchSize(1000) // Batch writes
.build();
blacklistedSessions.add("Some session token");
if (blacklistedSessions.mightContain("Some other session")) {
// Take steps to confirm if token is actually black listed or not.
}
BloomFilters.BloomFilterBuilder.withFalsePositiveProbabilityScaleFactor(double)
and
BloomFilters.BloomFilterBuilder.withCapacityGrowthFactor(double)
builder methods
to configure the scale factors for capacity and false positive probability in these implementations. The defaults
(0.8 and 2.0 respectively) provide a good trade off of memory growth and performance.
Rolling Bloom Filters allow elements in a Bloom Filter to expire over time. Use the BloomFilters.BloomFilterBuilder.withExpiryStrategy(org.forgerock.bloomfilter.ExpiryStrategy)
method to configure how elements in your Bloom Filter will expire. By default, elements do not expire.
BloomFilters.BloomFilterBuilder.withConcurrencyStrategy(org.forgerock.bloomfilter.ConcurrencyStrategy)
method to specify the concurrency strategy to use. The default is COPY_ON_WRITE.
BloomFilter.add(java.lang.Object)
method will be buffered in a traditional concurrent
collection class until the write batch size is reached. At this point, the buffer will be flushed to the
underlying bloom filter implementation in a single operation. This amortizes the cost of copying the underlying
collection, at the cost of increased worst-case latencies (when the buffer is flushed) and increased memory churn.
The implementation is very highly optimised, supporting very high throughput of both writes and reads, and so is a
good choice when throughput is paramount and occasional high write latencies can be tolerated. Use
BloomFilters.BloomFilterBuilder.withWriteBatchSize(int)
to enable write batching.Copyright © 2025 Open Identity Platform Community. All rights reserved.