Github user michaelandrepearce commented on a diff in the pull request:
https://github.com/apache/activemq-artemis/pull/1895#discussion_r170542143
--- Diff:
artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentLongHashMap.java
---
@@ -196,11 +202,13 @@ public ConcurrentLongHashSet keysLongHashSet() {
// A section is a portion of the hash map that is covered by a single
@SuppressWarnings("serial")
private static final class Section<V> extends StampedLock {
+
+ private static final AtomicIntegerFieldUpdater<Section>
CAPACITY_UPDATER = AtomicIntegerFieldUpdater.newUpdater(Section.class,
"capacity");
private long[] keys;
private V[] values;
private volatile int capacity;
- private volatile int size;
+ private int size;
--- End diff --
This needs to be volatile otherwise ++ or -- modifications of size can
become inconsistent.
---