From 6509c078fb4e4a60b40a4a44528453541caabb4b Mon Sep 17 00:00:00 2001 From: yang wei Date: Mon, 5 Feb 2018 18:12:18 +0800 Subject: [PATCH] ARTEMIS-1664 fix npe bug while getting element in the process of rehash --- .../artemis/utils/collections/ConcurrentLongHashMap.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentLongHashMap.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentLongHashMap.java index 8af0660be6..34a0e60dc0 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentLongHashMap.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentLongHashMap.java @@ -199,7 +199,7 @@ public class ConcurrentLongHashMap { private long[] keys; private V[] values; - private int capacity; + private volatile int capacity; private volatile int size; private int usedBuckets; private int resizeThreshold; @@ -457,10 +457,10 @@ public class ConcurrentLongHashMap { } } - capacity = newCapacity; keys = newKeys; values = newValues; usedBuckets = size; + capacity = newCapacity; resizeThreshold = (int) (capacity * MapFillFactor); }