You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
add method is slightly more trivial than contains since its checking and then setting bits, and also tracking whether any bit was added, eventually returning the added variable. So the caller can figure out if a new bit was set when adding an item. synchronized does makes sense in this case, but what if as a caller I am not concerned about whether a new bit was set on adding an element.
I have extended the BloomFilterMemory class in my project and made the two methods non synchronized, just wanted to be sure that I am not overlooking anything.
Thanks a lot for making and open-sourcing this.
The text was updated successfully, but these errors were encountered:
Hi
I am wondering if the method blocks for contain/add need to be
synchronized
?Orestes-Bloomfilter/src/main/java/orestes/bloomfilter/memory/BloomFilterMemory.java
Line 42 in a36840b
contains
method is a read-only check on the existing bits.Orestes-Bloomfilter/src/main/java/orestes/bloomfilter/memory/BloomFilterMemory.java
Line 25 in a36840b
add
method is slightly more trivial than contains since its checking and then setting bits, and also tracking whether any bit was added, eventually returning theadded
variable. So the caller can figure out if a new bit was set when adding an item.synchronized
does makes sense in this case, but what if as a caller I am not concerned about whether a new bit was set on adding an element.I have extended the
BloomFilterMemory
class in my project and made the two methods non synchronized, just wanted to be sure that I am not overlooking anything.Thanks a lot for making and open-sourcing this.
The text was updated successfully, but these errors were encountered: