From 2c32dda39e4edab7d34e3fb0db8217944df33977 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Andr=C3=A9=20Pearce?= Date: Thu, 22 Feb 2018 23:20:56 +0000 Subject: [PATCH] ARTEMIS-1664 fix npe bug while getting element in the process of rehash Apply same fix to ConcurrentLongHashSet --- .../artemis/utils/collections/ConcurrentLongHashSet.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentLongHashSet.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentLongHashSet.java index 17d94b7c51..8344c57f64 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentLongHashSet.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentLongHashSet.java @@ -165,7 +165,7 @@ public class ConcurrentLongHashSet { // Keys and values are stored interleaved in the table array private long[] table; - private int capacity; + private volatile int capacity; private volatile int size; private int usedBuckets; private int resizeThreshold; @@ -374,9 +374,9 @@ public class ConcurrentLongHashSet { } } - capacity = newCapacity; table = newTable; usedBuckets = size; + capacity = newCapacity; resizeThreshold = (int) (capacity * SetFillFactor); }