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
Doesn't the fact that globalOccurrences is a ConcurrentHashMap mean this is actually safe?
Not 100% sure, so using Atomic* is probably a good idea. Hopefully this doesn't slow things down too much.
But the documentation for compute() states "The entire method invocation is performed atomically.", and no other operations can occur at this time, right? (docIds.parallellStream() only calls compute() on globalOccurrences).
Again, seeing how hard this is to figure out for sure, going with Atomic* is probably the safest, or at the very least documenting why we think the code is safe as-is (i.e. the bottom line of this discussion, whatever that may turn out to be :-).
Intellij (rightfully) warns about non-atomic operation on volatile variable
BlackLab/engine/src/main/java/nl/inl/blacklab/search/results/HitGroupsTokenFrequencies.java
Line 299 in 5127196
Fix this by replacing the int and long with AtomicInteger and AtomicLong
It won't crash, but group sizes may too low because addition from one thread may be overwritten by subsequent addition in another thread.
The text was updated successfully, but these errors were encountered: