public class FilterMerger extends Object
A reusable object that will calculate, given a list of PeerFilterProvider
s, a merged
BloomFilter
and earliest key time for all of them.
Used by the PeerGroup
class internally.
Thread safety: this class tracks the element count of the last filter it calculated and so must be synchronised externally or used from only one thread. It will acquire a lock on each filter in turn before performing the calculation because the providers may be mutated in other threads in parallel, but global consistency is required to produce a merged filter.
Modifier and Type | Class and Description |
---|---|
static class |
FilterMerger.Result |
Constructor and Description |
---|
FilterMerger(double bloomFilterFPRate) |
Modifier and Type | Method and Description |
---|---|
FilterMerger.Result |
calculate(ImmutableList<PeerFilterProvider> providers) |
double |
getBloomFilterFPRate() |
BloomFilter |
getLastFilter() |
void |
setBloomFilterFPRate(double bloomFilterFPRate) |
public FilterMerger.Result calculate(ImmutableList<PeerFilterProvider> providers)
public void setBloomFilterFPRate(double bloomFilterFPRate)
public double getBloomFilterFPRate()
public BloomFilter getLastFilter()
Copyright © 2014. All rights reserved.