Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

thread-safe bloomfilter

Tags:

java

guava

I am looking for a thread-safe BloomFilter implementation, i.e., an implementation that will behave exactly the same if values are put into the filter in sequence or simultaneously in parallel. The javadoc for guava's BloomFilter is silent about thread-safety. Is it thread-safe?

like image 815
ishaaq Avatar asked Dec 29 '25 04:12

ishaaq


1 Answers

Guava's BloomFilter isn't thread-safe.

That said, it's not 100% clear to me what semantics you'd expect for a thread-safe BloomFilter -- would put be atomic? I'm imagining the effects of replacing the long[] with an AtomicLongArray, and I'm pretty sure the semantics you end up with are "if put(x) happens-before mightContain(x), then mightContain(x) returns true," and I think those semantics are useful, but I'm not positive.

This might be worth filing an issue with a specific use case, but there would be some details to work out about what thread-safety would mean here, exactly.

like image 128
Louis Wasserman Avatar answered Dec 30 '25 18:12

Louis Wasserman