activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From michaelandrepearce <...@git.apache.org>
Subject [GitHub] activemq-artemis pull request #1895: ARTEMIS-1702 ConcurrentLongHashMap and ...
Date Mon, 26 Feb 2018 10:03:12 GMT
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.


---

Mime
View raw message