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: threading here can be complicated. Each filter provider is given a begin event, which may acquire a lock (and is guaranteed to receive an end event). This class is mostly thread unsafe and is meant to be used from a single thread only, PeerGroup ensures this by only accessing it from the dedicated PeerGroup thread. PeerGroup does not hold any locks whilst this object is used, relying on the single thread to prevent multiple filters being calculated in parallel, thus a filter provider can do things like make blocking calls into PeerGroup from a separate thread. However the bloomFilterFPRate property IS thread safe, for convenience.
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 © 2016. All rights reserved.