[1/6] activemq-artemis git commit: ARTEMIS-1156: FIX: Long Autoboxing occurring on Hot Path

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[1/6] activemq-artemis git commit: ARTEMIS-1156: FIX: Long Autoboxing occurring on Hot Path

clebertsuconic-2
Repository: activemq-artemis
Updated Branches:
  refs/heads/master b7b79e5df -> 5e6687e0e


ARTEMIS-1156: FIX: Long Autoboxing occurring on Hot Path

Building on ARTEMIS-905 JCtools ConcurrentMap replacement  first proposed but currently parked by @franz1981, replace the collections with primitive key concurrent collections to avoid auto boxing.

The goal of this is to reduce/remove autoboxing on the hot path.
We are just adding jctools to the broker (should not be in client dependencies)
Like wise targeting specific use case with specific implementation rather than a blanket replace all.

Using collections from Bookkeeper, reduces outside tlab allocation, on resizing compared to JCTools, which occurs frequently on testing.


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/c1d55aa8
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/c1d55aa8
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/c1d55aa8

Branch: refs/heads/master
Commit: c1d55aa84f2ca9946afc39038c14d729c8bae36a
Parents: b7b79e5
Author: Michael André Pearce <[hidden email]>
Authored: Fri May 12 07:14:47 2017 +0100
Committer: Clebert Suconic <[hidden email]>
Committed: Fri May 12 10:05:51 2017 -0400

----------------------------------------------------------------------
 .../collections/ConcurrentLongHashMap.java      | 504 +++++++++++++++++++
 .../collections/ConcurrentLongHashSet.java      | 423 ++++++++++++++++
 .../collections/ConcurrentLongHashMapTest.java  | 405 +++++++++++++++
 .../collections/ConcurrentLongHashSetTest.java  | 249 +++++++++
 .../journal/impl/AbstractJournalUpdateTask.java |   9 +-
 .../core/journal/impl/FileWrapperJournal.java   |  13 +-
 .../core/journal/impl/JournalCompactor.java     |  20 +-
 .../artemis/core/journal/impl/JournalImpl.java  |  36 +-
 .../journal/impl/JournalRecordProvider.java     |   4 +-
 .../core/replication/ReplicationEndpoint.java   |   2 +-
 .../JournalCleanupCompactStressTest.java        |  14 +-
 11 files changed, 1628 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c1d55aa8/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentLongHashMap.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..8af0660
--- /dev/null
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentLongHashMap.java
@@ -0,0 +1,504 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.activemq.artemis.utils.collections;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Arrays;
+import java.util.List;
+
+import java.util.concurrent.locks.StampedLock;
+import java.util.function.LongFunction;
+
+import com.google.common.collect.Lists;
+
+/**
+ * Map from long to an Object.
+ *
+ * Provides similar methods as a ConcurrentMap<long,Object> with 2 differences:
+ * <ol>
+ * <li>No boxing/unboxing from long -> Long
+ * <li>Open hash map with linear probing, no node allocations to store the values
+ * </ol>
+ *
+ * @param <V>
+ */
+@SuppressWarnings("unchecked")
+public class ConcurrentLongHashMap<V> {
+
+   private static final Object EmptyValue = null;
+   private static final Object DeletedValue = new Object();
+
+   private static final float MapFillFactor = 0.66f;
+
+   private static final int DefaultExpectedItems = 256;
+   private static final int DefaultConcurrencyLevel = 16;
+
+   private final Section<V>[] sections;
+
+   public ConcurrentLongHashMap() {
+      this(DefaultExpectedItems);
+   }
+
+   public ConcurrentLongHashMap(int expectedItems) {
+      this(expectedItems, DefaultConcurrencyLevel);
+   }
+
+   public ConcurrentLongHashMap(int expectedItems, int numSections) {
+      checkArgument(numSections > 0);
+      if (expectedItems < numSections) {
+         expectedItems = numSections;
+      }
+
+      int perSectionExpectedItems = expectedItems / numSections;
+      int perSectionCapacity = (int) (perSectionExpectedItems / MapFillFactor);
+      this.sections = (Section<V>[]) new Section[numSections];
+
+      for (int i = 0; i < numSections; i++) {
+         sections[i] = new Section<>(perSectionCapacity);
+      }
+   }
+
+   public int size() {
+      int size = 0;
+      for (Section<V> s : sections) {
+         size += s.size;
+      }
+      return size;
+   }
+
+   long getUsedBucketCount() {
+      long usedBucketCount = 0;
+      for (Section<V> s : sections) {
+         usedBucketCount += s.usedBuckets;
+      }
+      return usedBucketCount;
+   }
+
+   public long capacity() {
+      long capacity = 0;
+      for (Section<V> s : sections) {
+         capacity += s.capacity;
+      }
+      return capacity;
+   }
+
+   public boolean isEmpty() {
+      for (Section<V> s : sections) {
+         if (s.size != 0) {
+            return false;
+         }
+      }
+
+      return true;
+   }
+
+   public V get(long key) {
+      long h = hash(key);
+      return getSection(h).get(key, (int) h);
+   }
+
+   public boolean containsKey(long key) {
+      return get(key) != null;
+   }
+
+   public V put(long key, V value) {
+      checkNotNull(value);
+      long h = hash(key);
+      return getSection(h).put(key, value, (int) h, false, null);
+   }
+
+   public V putIfAbsent(long key, V value) {
+      checkNotNull(value);
+      long h = hash(key);
+      return getSection(h).put(key, value, (int) h, true, null);
+   }
+
+   public V computeIfAbsent(long key, LongFunction<V> provider) {
+      checkNotNull(provider);
+      long h = hash(key);
+      return getSection(h).put(key, null, (int) h, true, provider);
+   }
+
+   public V remove(long key) {
+      long h = hash(key);
+      return getSection(h).remove(key, null, (int) h);
+   }
+
+   public boolean remove(long key, Object value) {
+      checkNotNull(value);
+      long h = hash(key);
+      return getSection(h).remove(key, value, (int) h) != null;
+   }
+
+   private Section<V> getSection(long hash) {
+      // Use 32 msb out of long to get the section
+      final int sectionIdx = (int) (hash >>> 32) & (sections.length - 1);
+      return sections[sectionIdx];
+   }
+
+   public void clear() {
+      for (Section<V> s : sections) {
+         s.clear();
+      }
+   }
+
+   public void forEach(EntryProcessor<V> processor) {
+      for (Section<V> s : sections) {
+         s.forEach(processor);
+      }
+   }
+
+   /**
+    * @return a new list of all keys (makes a copy)
+    */
+   public List<Long> keys() {
+      List<Long> keys = Lists.newArrayListWithExpectedSize((int) size());
+      forEach((key, value) -> keys.add(key));
+      return keys;
+   }
+
+   public ConcurrentLongHashSet keysLongHashSet() {
+      ConcurrentLongHashSet concurrentLongHashSet = new ConcurrentLongHashSet(size());
+      forEach((key, value) -> concurrentLongHashSet.add(key));
+      return concurrentLongHashSet;
+   }
+
+   public List<V> values() {
+      List<V> values = Lists.newArrayListWithExpectedSize((int) size());
+      forEach((key, value) -> values.add(value));
+      return values;
+   }
+
+   public interface EntryProcessor<V> {
+      void accept(long key, V value);
+   }
+
+   // 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 long[] keys;
+      private V[] values;
+
+      private int capacity;
+      private volatile int size;
+      private int usedBuckets;
+      private int resizeThreshold;
+
+      Section(int capacity) {
+         this.capacity = alignToPowerOfTwo(capacity);
+         this.keys = new long[this.capacity];
+         this.values = (V[]) new Object[this.capacity];
+         this.size = 0;
+         this.usedBuckets = 0;
+         this.resizeThreshold = (int) (this.capacity * MapFillFactor);
+      }
+
+      @SuppressWarnings("NonAtomicVolatileUpdate")
+      V get(long key, int keyHash) {
+         int bucket = keyHash;
+
+         long stamp = tryOptimisticRead();
+         boolean acquiredLock = false;
+
+         try {
+            while (true) {
+               int capacity = this.capacity;
+               bucket = signSafeMod(bucket, capacity);
+
+               // First try optimistic locking
+               long storedKey = keys[bucket];
+               V storedValue = values[bucket];
+
+               if (!acquiredLock && validate(stamp)) {
+                  // The values we have read are consistent
+                  if (storedKey == key) {
+                     return storedValue != DeletedValue ? storedValue : null;
+                  } else if (storedValue == EmptyValue) {
+                     // Not found
+                     return null;
+                  }
+               } else {
+                  // Fallback to acquiring read lock
+                  if (!acquiredLock) {
+                     stamp = readLock();
+                     acquiredLock = true;
+                     storedKey = keys[bucket];
+                     storedValue = values[bucket];
+                  }
+
+                  if (capacity != this.capacity) {
+                     // There has been a rehashing. We need to restart the search
+                     bucket = keyHash;
+                     continue;
+                  }
+
+                  if (storedKey == key) {
+                     return storedValue != DeletedValue ? storedValue : null;
+                  } else if (storedValue == EmptyValue) {
+                     // Not found
+                     return null;
+                  }
+               }
+
+               ++bucket;
+            }
+         } finally {
+            if (acquiredLock) {
+               unlockRead(stamp);
+            }
+         }
+      }
+
+      @SuppressWarnings("NonAtomicVolatileUpdate")
+      V put(long key, V value, int keyHash, boolean onlyIfAbsent, LongFunction<V> valueProvider) {
+         int bucket = keyHash;
+
+         long stamp = writeLock();
+         int capacity = this.capacity;
+
+         // Remember where we find the first available spot
+         int firstDeletedKey = -1;
+
+         try {
+            while (true) {
+               bucket = signSafeMod(bucket, capacity);
+
+               long storedKey = keys[bucket];
+               V storedValue = values[bucket];
+
+               if (storedKey == key) {
+                  if (storedValue == EmptyValue) {
+                     values[bucket] = value != null ? value : valueProvider.apply(key);
+                     ++size;
+                     ++usedBuckets;
+                     return valueProvider != null ? values[bucket] : null;
+                  } else if (storedValue == DeletedValue) {
+                     values[bucket] = value != null ? value : valueProvider.apply(key);
+                     ++size;
+                     return valueProvider != null ? values[bucket] : null;
+                  } else if (!onlyIfAbsent) {
+                     // Over written an old value for same key
+                     values[bucket] = value;
+                     return storedValue;
+                  } else {
+                     return storedValue;
+                  }
+               } else if (storedValue == EmptyValue) {
+                  // Found an empty bucket. This means the key is not in the map. If we've already seen a deleted
+                  // key, we should write at that position
+                  if (firstDeletedKey != -1) {
+                     bucket = firstDeletedKey;
+                  } else {
+                     ++usedBuckets;
+                  }
+
+                  keys[bucket] = key;
+                  values[bucket] = value != null ? value : valueProvider.apply(key);
+                  ++size;
+                  return valueProvider != null ? values[bucket] : null;
+               } else if (storedValue == DeletedValue) {
+                  // The bucket contained a different deleted key
+                  if (firstDeletedKey == -1) {
+                     firstDeletedKey = bucket;
+                  }
+               }
+
+               ++bucket;
+            }
+         } finally {
+            if (usedBuckets > resizeThreshold) {
+               try {
+                  rehash();
+               } finally {
+                  unlockWrite(stamp);
+               }
+            } else {
+               unlockWrite(stamp);
+            }
+         }
+      }
+
+      @SuppressWarnings("NonAtomicVolatileUpdate")
+      private V remove(long key, Object value, int keyHash) {
+         int bucket = keyHash;
+         long stamp = writeLock();
+
+         try {
+            while (true) {
+               int capacity = this.capacity;
+               bucket = signSafeMod(bucket, capacity);
+
+               long storedKey = keys[bucket];
+               V storedValue = values[bucket];
+               if (storedKey == key) {
+                  if (value == null || value.equals(storedValue)) {
+                     if (storedValue == EmptyValue || storedValue == DeletedValue) {
+                        return null;
+                     }
+
+                     --size;
+                     V nextValueInArray = values[signSafeMod(bucket + 1, capacity)];
+                     if (nextValueInArray == EmptyValue) {
+                        values[bucket] = (V) EmptyValue;
+                        --usedBuckets;
+                     } else {
+                        values[bucket] = (V) DeletedValue;
+                     }
+
+                     return storedValue;
+                  } else {
+                     return null;
+                  }
+               } else if (storedValue == EmptyValue) {
+                  // Key wasn't found
+                  return null;
+               }
+
+               ++bucket;
+            }
+
+         } finally {
+            unlockWrite(stamp);
+         }
+      }
+
+      void clear() {
+         long stamp = writeLock();
+
+         try {
+            Arrays.fill(keys, 0);
+            Arrays.fill(values, EmptyValue);
+            this.size = 0;
+            this.usedBuckets = 0;
+         } finally {
+            unlockWrite(stamp);
+         }
+      }
+
+      public void forEach(EntryProcessor<V> processor) {
+         long stamp = tryOptimisticRead();
+
+         int capacity = this.capacity;
+         long[] keys = this.keys;
+         V[] values = this.values;
+
+         boolean acquiredReadLock = false;
+
+         try {
+
+            // Validate no rehashing
+            if (!validate(stamp)) {
+               // Fallback to read lock
+               stamp = readLock();
+               acquiredReadLock = true;
+
+               capacity = this.capacity;
+               keys = this.keys;
+               values = this.values;
+            }
+
+            // Go through all the buckets for this section
+            for (int bucket = 0; bucket < capacity; bucket++) {
+               long storedKey = keys[bucket];
+               V storedValue = values[bucket];
+
+               if (!acquiredReadLock && !validate(stamp)) {
+                  // Fallback to acquiring read lock
+                  stamp = readLock();
+                  acquiredReadLock = true;
+
+                  storedKey = keys[bucket];
+                  storedValue = values[bucket];
+               }
+
+               if (storedValue != DeletedValue && storedValue != EmptyValue) {
+                  processor.accept(storedKey, storedValue);
+               }
+            }
+         } finally {
+            if (acquiredReadLock) {
+               unlockRead(stamp);
+            }
+         }
+      }
+
+      private void rehash() {
+         // Expand the hashmap
+         int newCapacity = capacity * 2;
+         long[] newKeys = new long[newCapacity];
+         V[] newValues = (V[]) new Object[newCapacity];
+
+         // Re-hash table
+         for (int i = 0; i < keys.length; i++) {
+            long storedKey = keys[i];
+            V storedValue = values[i];
+            if (storedValue != EmptyValue && storedValue != DeletedValue) {
+               insertKeyValueNoLock(newKeys, newValues, storedKey, storedValue);
+            }
+         }
+
+         capacity = newCapacity;
+         keys = newKeys;
+         values = newValues;
+         usedBuckets = size;
+         resizeThreshold = (int) (capacity * MapFillFactor);
+      }
+
+      private static <V> void insertKeyValueNoLock(long[] keys, V[] values, long key, V value) {
+         int bucket = (int) hash(key);
+
+         while (true) {
+            bucket = signSafeMod(bucket, keys.length);
+
+            V storedValue = values[bucket];
+
+            if (storedValue == EmptyValue) {
+               // The bucket is empty, so we can use it
+               keys[bucket] = key;
+               values[bucket] = value;
+               return;
+            }
+
+            ++bucket;
+         }
+      }
+   }
+
+   private static final long HashMixer = 0xc6a4a7935bd1e995L;
+   private static final int R = 47;
+
+   static long hash(long key) {
+      long hash = key * HashMixer;
+      hash ^= hash >>> R;
+      hash *= HashMixer;
+      return hash;
+   }
+
+   static int signSafeMod(long n, int Max) {
+      return (int) n & (Max - 1);
+   }
+
+   static int alignToPowerOfTwo(int n) {
+      return (int) Math.pow(2, 32 - Integer.numberOfLeadingZeros(n - 1));
+   }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c1d55aa8/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentLongHashSet.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..17d94b7
--- /dev/null
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentLongHashSet.java
@@ -0,0 +1,423 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.activemq.artemis.utils.collections;
+
+import static com.google.common.base.Preconditions.checkArgument;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.locks.StampedLock;
+
+/**
+ * Concurrent hash set for primitive longs
+ *
+ * Provides similar methods as a ConcurrentSet&lt;Long&gt; but since it's an open hash map with linear probing, no node
+ * allocations are required to store the values.
+ * <p>
+ * Items <strong>MUST</strong> be >= 0.
+ */
+public class ConcurrentLongHashSet {
+
+   private static final long EmptyItem = -1L;
+   private static final long DeletedItem = -2L;
+
+   private static final float SetFillFactor = 0.66f;
+
+   private static final int DefaultExpectedItems = 256;
+   private static final int DefaultConcurrencyLevel = 16;
+
+   private final Section[] sections;
+
+   public interface ConsumerLong {
+      void accept(long item);
+   }
+
+   public ConcurrentLongHashSet() {
+      this(DefaultExpectedItems);
+   }
+
+   public ConcurrentLongHashSet(int expectedItems) {
+      this(expectedItems, DefaultConcurrencyLevel);
+   }
+
+   public ConcurrentLongHashSet(int expectedItems, final int numSections) {
+      checkArgument(numSections > 0);
+      if (expectedItems < numSections) {
+         expectedItems = numSections;
+      }
+
+      int perSectionExpectedItems = expectedItems / numSections;
+      int perSectionCapacity = (int) (perSectionExpectedItems / SetFillFactor);
+      this.sections = new Section[numSections];
+
+      for (int i = 0; i < numSections; i++) {
+         sections[i] = new Section(perSectionCapacity);
+      }
+   }
+
+   public int size() {
+      int size = 0;
+      for (Section s : sections) {
+         size += s.size;
+      }
+      return size;
+   }
+
+   public long capacity() {
+      long capacity = 0;
+      for (Section s : sections) {
+         capacity += s.capacity;
+      }
+      return capacity;
+   }
+
+   public boolean isEmpty() {
+      for (Section s : sections) {
+         if (s.size != 0) {
+            return false;
+         }
+      }
+
+      return true;
+   }
+
+   long getUsedBucketCount() {
+      long usedBucketCount = 0;
+      for (Section s : sections) {
+         usedBucketCount += s.usedBuckets;
+      }
+      return usedBucketCount;
+   }
+
+   public boolean contains(long item) {
+      checkBiggerEqualZero(item);
+      long h = hash(item);
+      return getSection(h).contains(item, (int) h);
+   }
+
+   public boolean add(long item) {
+      checkBiggerEqualZero(item);
+      long h = hash(item);
+      return getSection(h).add(item, (int) h);
+   }
+
+   /**
+    * Remove an existing entry if found
+    *
+    * @param item
+    * @return true if removed or false if item was not present
+    */
+   public boolean remove(long item) {
+      checkBiggerEqualZero(item);
+      long h = hash(item);
+      return getSection(h).remove(item, (int) h);
+   }
+
+   private Section getSection(long hash) {
+      // Use 32 msb out of long to get the section
+      final int sectionIdx = (int) (hash >>> 32) & (sections.length - 1);
+      return sections[sectionIdx];
+   }
+
+   public void clear() {
+      for (Section s : sections) {
+         s.clear();
+      }
+   }
+
+   public void forEach(ConsumerLong processor) {
+      for (Section s : sections) {
+         s.forEach(processor);
+      }
+   }
+
+   /**
+    * @return a new list of all keys (makes a copy)
+    */
+   public Set<Long> items() {
+      Set<Long> items = new HashSet<>();
+      forEach(items::add);
+      return items;
+   }
+
+   // A section is a portion of the hash map that is covered by a single
+   @SuppressWarnings("serial")
+   private static final class Section extends StampedLock {
+      // Keys and values are stored interleaved in the table array
+      private long[] table;
+
+      private int capacity;
+      private volatile int size;
+      private int usedBuckets;
+      private int resizeThreshold;
+
+      Section(int capacity) {
+         this.capacity = alignToPowerOfTwo(capacity);
+         this.table = new long[this.capacity];
+         this.size = 0;
+         this.usedBuckets = 0;
+         this.resizeThreshold = (int) (this.capacity * SetFillFactor);
+         Arrays.fill(table, EmptyItem);
+      }
+
+      boolean contains(long item, int hash) {
+         long stamp = tryOptimisticRead();
+         boolean acquiredLock = false;
+         int bucket = signSafeMod(hash, capacity);
+
+         try {
+            while (true) {
+               // First try optimistic locking
+               long storedItem = table[bucket];
+
+               if (!acquiredLock && validate(stamp)) {
+                  // The values we have read are consistent
+                  if (item == storedItem) {
+                     return true;
+                  } else if (storedItem == EmptyItem) {
+                     // Not found
+                     return false;
+                  }
+               } else {
+                  // Fallback to acquiring read lock
+                  if (!acquiredLock) {
+                     stamp = readLock();
+                     acquiredLock = true;
+
+                     bucket = signSafeMod(hash, capacity);
+                     storedItem = table[bucket];
+                  }
+
+                  if (item == storedItem) {
+                     return true;
+                  } else if (storedItem == EmptyItem) {
+                     // Not found
+                     return false;
+                  }
+               }
+
+               bucket = (bucket + 1) & (table.length - 1);
+            }
+         } finally {
+            if (acquiredLock) {
+               unlockRead(stamp);
+            }
+         }
+      }
+
+      @SuppressWarnings("NonAtomicVolatileUpdate")
+      boolean add(long item, long hash) {
+         long stamp = writeLock();
+         int bucket = signSafeMod(hash, capacity);
+
+         // Remember where we find the first available spot
+         int firstDeletedItem = -1;
+
+         try {
+            while (true) {
+               long storedItem = table[bucket];
+
+               if (item == storedItem) {
+                  // Item was already in set
+                  return false;
+               } else if (storedItem == EmptyItem) {
+                  // Found an empty bucket. This means the key is not in the map. If we've already seen a deleted
+                  // key, we should write at that position
+                  if (firstDeletedItem != -1) {
+                     bucket = firstDeletedItem;
+                  } else {
+                     ++usedBuckets;
+                  }
+
+                  table[bucket] = item;
+                  ++size;
+                  return true;
+               } else if (storedItem == DeletedItem) {
+                  // The bucket contained a different deleted key
+                  if (firstDeletedItem == -1) {
+                     firstDeletedItem = bucket;
+                  }
+               }
+
+               bucket = (bucket + 1) & (table.length - 1);
+            }
+         } finally {
+            if (usedBuckets > resizeThreshold) {
+               try {
+                  rehash();
+               } finally {
+                  unlockWrite(stamp);
+               }
+            } else {
+               unlockWrite(stamp);
+            }
+         }
+      }
+
+      @SuppressWarnings("NonAtomicVolatileUpdate")
+      private boolean remove(long item, int hash) {
+         long stamp = writeLock();
+         int bucket = signSafeMod(hash, capacity);
+
+         try {
+            while (true) {
+               long storedItem = table[bucket];
+               if (item == storedItem) {
+                  --size;
+
+                  cleanBucket(bucket);
+                  return true;
+
+               } else if (storedItem == EmptyItem) {
+                  // Key wasn't found
+                  return false;
+               }
+
+               bucket = (bucket + 1) & (table.length - 1);
+            }
+         } finally {
+            unlockWrite(stamp);
+         }
+      }
+
+      private void cleanBucket(int bucket) {
+         int nextInArray = (bucket + 1) & (table.length - 1);
+         if (table[nextInArray] == EmptyItem) {
+            table[bucket] = EmptyItem;
+            --usedBuckets;
+         } else {
+            table[bucket] = DeletedItem;
+         }
+      }
+
+      void clear() {
+         long stamp = writeLock();
+
+         try {
+            Arrays.fill(table, EmptyItem);
+            this.size = 0;
+            this.usedBuckets = 0;
+         } finally {
+            unlockWrite(stamp);
+         }
+      }
+
+      public void forEach(ConsumerLong processor) {
+         long stamp = tryOptimisticRead();
+
+         long[] table = this.table;
+         boolean acquiredReadLock = false;
+
+         try {
+
+            // Validate no rehashing
+            if (!validate(stamp)) {
+               // Fallback to read lock
+               stamp = readLock();
+               acquiredReadLock = true;
+               table = this.table;
+            }
+
+            // Go through all the buckets for this section
+            for (int bucket = 0; bucket < table.length; bucket++) {
+               long storedItem = table[bucket];
+
+               if (!acquiredReadLock && !validate(stamp)) {
+                  // Fallback to acquiring read lock
+                  stamp = readLock();
+                  acquiredReadLock = true;
+
+                  storedItem = table[bucket];
+               }
+
+               if (storedItem != DeletedItem && storedItem != EmptyItem) {
+                  processor.accept(storedItem);
+               }
+            }
+         } finally {
+            if (acquiredReadLock) {
+               unlockRead(stamp);
+            }
+         }
+      }
+
+      private void rehash() {
+         // Expand the hashmap
+         int newCapacity = capacity * 2;
+         long[] newTable = new long[newCapacity];
+         Arrays.fill(newTable, EmptyItem);
+
+         // Re-hash table
+         for (int i = 0; i < table.length; i++) {
+            long storedItem = table[i];
+            if (storedItem != EmptyItem && storedItem != DeletedItem) {
+               insertKeyValueNoLock(newTable, newCapacity, storedItem);
+            }
+         }
+
+         capacity = newCapacity;
+         table = newTable;
+         usedBuckets = size;
+         resizeThreshold = (int) (capacity * SetFillFactor);
+      }
+
+      private static void insertKeyValueNoLock(long[] table, int capacity, long item) {
+         int bucket = signSafeMod(hash(item), capacity);
+
+         while (true) {
+            long storedKey = table[bucket];
+
+            if (storedKey == EmptyItem) {
+               // The bucket is empty, so we can use it
+               table[bucket] = item;
+               return;
+            }
+
+            bucket = (bucket + 1) & (table.length - 1);
+         }
+      }
+   }
+
+   private static final long HashMixer = 0xc6a4a7935bd1e995L;
+   private static final int R = 47;
+
+   static long hash(long key) {
+      long hash = key * HashMixer;
+      hash ^= hash >>> R;
+      hash *= HashMixer;
+      return hash;
+   }
+
+   static int signSafeMod(long n, int Max) {
+      return (int) (n & (Max - 1));
+   }
+
+   static int alignToPowerOfTwo(int n) {
+      return (int) Math.pow(2, 32 - Integer.numberOfLeadingZeros(n - 1));
+   }
+
+   static void checkBiggerEqualZero(long n) {
+      if (n < 0L) {
+         throw new IllegalArgumentException("Keys and values must be >= 0");
+      }
+   }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c1d55aa8/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/collections/ConcurrentLongHashMapTest.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/collections/ConcurrentLongHashMapTest.java b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/collections/ConcurrentLongHashMapTest.java
new file mode 100644
index 0000000..b08251f
--- /dev/null
+++ b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/collections/ConcurrentLongHashMapTest.java
@@ -0,0 +1,405 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.activemq.artemis.utils.collections;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.LongFunction;
+
+import com.google.common.collect.Lists;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
+
+public class ConcurrentLongHashMapTest {
+
+   @Test
+   public void simpleInsertions() {
+      ConcurrentLongHashMap<String> map = new ConcurrentLongHashMap<>(16);
+
+      assertTrue(map.isEmpty());
+      assertNull(map.put(1, "one"));
+      assertFalse(map.isEmpty());
+
+      assertNull(map.put(2, "two"));
+      assertNull(map.put(3, "three"));
+
+      assertEquals(map.size(), 3);
+
+      assertEquals(map.get(1), "one");
+      assertEquals(map.size(), 3);
+
+      assertEquals(map.remove(1), "one");
+      assertEquals(map.size(), 2);
+      assertEquals(map.get(1), null);
+      assertEquals(map.get(5), null);
+      assertEquals(map.size(), 2);
+
+      assertNull(map.put(1, "one"));
+      assertEquals(map.size(), 3);
+      assertEquals(map.put(1, "uno"), "one");
+      assertEquals(map.size(), 3);
+   }
+
+   @Test
+   public void testRemove() {
+      ConcurrentLongHashMap<String> map = new ConcurrentLongHashMap<>();
+
+      assertTrue(map.isEmpty());
+      assertNull(map.put(1, "one"));
+      assertFalse(map.isEmpty());
+
+      assertFalse(map.remove(0, "zero"));
+      assertFalse(map.remove(1, "uno"));
+
+      assertFalse(map.isEmpty());
+      assertTrue(map.remove(1, "one"));
+      assertTrue(map.isEmpty());
+   }
+
+   @Test
+   public void testNegativeUsedBucketCount() {
+      ConcurrentLongHashMap<String> map = new ConcurrentLongHashMap<>(16, 1);
+
+      map.put(0, "zero");
+      assertEquals(1, map.getUsedBucketCount());
+      map.put(0, "zero1");
+      assertEquals(1, map.getUsedBucketCount());
+      map.remove(0);
+      assertEquals(0, map.getUsedBucketCount());
+      map.remove(0);
+      assertEquals(0, map.getUsedBucketCount());
+   }
+
+   @Test
+   public void testRehashing() {
+      int n = 16;
+      ConcurrentLongHashMap<Integer> map = new ConcurrentLongHashMap<>(n / 2, 1);
+      assertEquals(map.capacity(), n);
+      assertEquals(map.size(), 0);
+
+      for (int i = 0; i < n; i++) {
+         map.put(i, i);
+      }
+
+      assertEquals(map.capacity(), 2 * n);
+      assertEquals(map.size(), n);
+   }
+
+   @Test
+   public void testRehashingWithDeletes() {
+      int n = 16;
+      ConcurrentLongHashMap<Integer> map = new ConcurrentLongHashMap<>(n / 2, 1);
+      assertEquals(map.capacity(), n);
+      assertEquals(map.size(), 0);
+
+      for (int i = 0; i < n / 2; i++) {
+         map.put(i, i);
+      }
+
+      for (int i = 0; i < n / 2; i++) {
+         map.remove(i);
+      }
+
+      for (int i = n; i < (2 * n); i++) {
+         map.put(i, i);
+      }
+
+      assertEquals(map.capacity(), 2 * n);
+      assertEquals(map.size(), n);
+   }
+
+   @Test
+   public void concurrentInsertions() throws Throwable {
+      ConcurrentLongHashMap<String> map = new ConcurrentLongHashMap<>();
+      ExecutorService executor = Executors.newCachedThreadPool();
+
+      final int nThreads = 16;
+      final int N = 100_000;
+      String value = "value";
+
+      List<Future<?>> futures = new ArrayList<>();
+      for (int i = 0; i < nThreads; i++) {
+         final int threadIdx = i;
+
+         futures.add(executor.submit(() -> {
+            Random random = new Random();
+
+            for (int j = 0; j < N; j++) {
+               long key = random.nextLong();
+               // Ensure keys are uniques
+               key -= key % (threadIdx + 1);
+
+               map.put(key, value);
+            }
+         }));
+      }
+
+      for (Future<?> future : futures) {
+         future.get();
+      }
+
+      assertEquals(map.size(), N * nThreads);
+
+      executor.shutdown();
+   }
+
+   @Test
+   public void concurrentInsertionsAndReads() throws Throwable {
+      ConcurrentLongHashMap<String> map = new ConcurrentLongHashMap<>();
+      ExecutorService executor = Executors.newCachedThreadPool();
+
+      final int nThreads = 16;
+      final int N = 100_000;
+      String value = "value";
+
+      List<Future<?>> futures = new ArrayList<>();
+      for (int i = 0; i < nThreads; i++) {
+         final int threadIdx = i;
+
+         futures.add(executor.submit(() -> {
+            Random random = new Random();
+
+            for (int j = 0; j < N; j++) {
+               long key = random.nextLong();
+               // Ensure keys are uniques
+               key -= key % (threadIdx + 1);
+
+               map.put(key, value);
+            }
+         }));
+      }
+
+      for (Future<?> future : futures) {
+         future.get();
+      }
+
+      assertEquals(map.size(), N * nThreads);
+
+      executor.shutdown();
+   }
+
+   @Test
+   public void testIteration() {
+      ConcurrentLongHashMap<String> map = new ConcurrentLongHashMap<>();
+
+      assertEquals(map.keys(), Collections.emptyList());
+      assertEquals(map.values(), Collections.emptyList());
+
+      map.put(0, "zero");
+
+      assertEquals(map.keys(), Lists.newArrayList(0L));
+      assertEquals(map.values(), Lists.newArrayList("zero"));
+
+      map.remove(0);
+
+      assertEquals(map.keys(), Collections.emptyList());
+      assertEquals(map.values(), Collections.emptyList());
+
+      map.put(0, "zero");
+      map.put(1, "one");
+      map.put(2, "two");
+
+      List<Long> keys = map.keys();
+      Collections.sort(keys);
+      assertEquals(keys, Lists.newArrayList(0L, 1L, 2L));
+
+      List<String> values = map.values();
+      Collections.sort(values);
+      assertEquals(values, Lists.newArrayList("one", "two", "zero"));
+
+      map.put(1, "uno");
+
+      keys = map.keys();
+      Collections.sort(keys);
+      assertEquals(keys, Lists.newArrayList(0L, 1L, 2L));
+
+      values = map.values();
+      Collections.sort(values);
+      assertEquals(values, Lists.newArrayList("two", "uno", "zero"));
+
+      map.clear();
+      assertTrue(map.isEmpty());
+   }
+
+   @Test
+   public void testHashConflictWithDeletion() {
+      final int Buckets = 16;
+      ConcurrentLongHashMap<String> map = new ConcurrentLongHashMap<>(Buckets, 1);
+
+      // Pick 2 keys that fall into the same bucket
+      long key1 = 1;
+      long key2 = 27;
+
+      int bucket1 = ConcurrentLongHashMap.signSafeMod(ConcurrentLongHashMap.hash(key1), Buckets);
+      int bucket2 = ConcurrentLongHashMap.signSafeMod(ConcurrentLongHashMap.hash(key2), Buckets);
+      assertEquals(bucket1, bucket2);
+
+      assertEquals(map.put(key1, "value-1"), null);
+      assertEquals(map.put(key2, "value-2"), null);
+      assertEquals(map.size(), 2);
+
+      assertEquals(map.remove(key1), "value-1");
+      assertEquals(map.size(), 1);
+
+      assertEquals(map.put(key1, "value-1-overwrite"), null);
+      assertEquals(map.size(), 2);
+
+      assertEquals(map.remove(key1), "value-1-overwrite");
+      assertEquals(map.size(), 1);
+
+      assertEquals(map.put(key2, "value-2-overwrite"), "value-2");
+      assertEquals(map.get(key2), "value-2-overwrite");
+
+      assertEquals(map.size(), 1);
+      assertEquals(map.remove(key2), "value-2-overwrite");
+      assertTrue(map.isEmpty());
+   }
+
+   @Test
+   public void testPutIfAbsent() {
+      ConcurrentLongHashMap<String> map = new ConcurrentLongHashMap<>();
+      assertEquals(map.putIfAbsent(1, "one"), null);
+      assertEquals(map.get(1), "one");
+
+      assertEquals(map.putIfAbsent(1, "uno"), "one");
+      assertEquals(map.get(1), "one");
+   }
+
+   @Test
+   public void testComputeIfAbsent() {
+      ConcurrentLongHashMap<Integer> map = new ConcurrentLongHashMap<>(16, 1);
+      AtomicInteger counter = new AtomicInteger();
+      LongFunction<Integer> provider = key -> counter.getAndIncrement();
+
+      assertEquals(map.computeIfAbsent(0, provider).intValue(), 0);
+      assertEquals(map.get(0).intValue(), 0);
+
+      assertEquals(map.computeIfAbsent(1, provider).intValue(), 1);
+      assertEquals(map.get(1).intValue(), 1);
+
+      assertEquals(map.computeIfAbsent(1, provider).intValue(), 1);
+      assertEquals(map.get(1).intValue(), 1);
+
+      assertEquals(map.computeIfAbsent(2, provider).intValue(), 2);
+      assertEquals(map.get(2).intValue(), 2);
+   }
+
+   int Iterations = 1;
+   int ReadIterations = 100;
+   int N = 1_000_000;
+
+   public void benchConcurrentLongHashMap() throws Exception {
+      // public static void main(String args[]) {
+      ConcurrentLongHashMap<String> map = new ConcurrentLongHashMap<>(N, 1);
+
+      for (long i = 0; i < Iterations; i++) {
+         for (int j = 0; j < N; j++) {
+            map.put(i, "value");
+         }
+
+         for (long h = 0; h < ReadIterations; h++) {
+            for (int j = 0; j < N; j++) {
+               map.get(i);
+            }
+         }
+
+         for (int j = 0; j < N; j++) {
+            map.remove(i);
+         }
+      }
+   }
+
+   public void benchConcurrentHashMap() throws Exception {
+      ConcurrentHashMap<Long, String> map = new ConcurrentHashMap<>(N, 0.66f, 1);
+
+      for (long i = 0; i < Iterations; i++) {
+         for (int j = 0; j < N; j++) {
+            map.put(i, "value");
+         }
+
+         for (long h = 0; h < ReadIterations; h++) {
+            for (int j = 0; j < N; j++) {
+               map.get(i);
+            }
+         }
+
+         for (int j = 0; j < N; j++) {
+            map.remove(i);
+         }
+      }
+   }
+
+   void benchHashMap() throws Exception {
+      HashMap<Long, String> map = new HashMap<>(N, 0.66f);
+
+      for (long i = 0; i < Iterations; i++) {
+         for (int j = 0; j < N; j++) {
+            map.put(i, "value");
+         }
+
+         for (long h = 0; h < ReadIterations; h++) {
+            for (int j = 0; j < N; j++) {
+               map.get(i);
+            }
+         }
+
+         for (int j = 0; j < N; j++) {
+            map.remove(i);
+         }
+      }
+   }
+
+   public static void main(String[] args) throws Exception {
+      ConcurrentLongHashMapTest t = new ConcurrentLongHashMapTest();
+
+      long start = System.nanoTime();
+      // t.benchHashMap();
+      long end = System.nanoTime();
+
+      System.out.println("HM:   " + TimeUnit.NANOSECONDS.toMillis(end - start) + " ms");
+
+      start = System.nanoTime();
+      t.benchConcurrentHashMap();
+      end = System.nanoTime();
+
+      System.out.println("CHM:  " + TimeUnit.NANOSECONDS.toMillis(end - start) + " ms");
+
+      start = System.nanoTime();
+      // t.benchConcurrentLongHashMap();
+      end = System.nanoTime();
+
+      System.out.println("CLHM: " + TimeUnit.NANOSECONDS.toMillis(end - start) + " ms");
+
+   }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c1d55aa8/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/collections/ConcurrentLongHashSetTest.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/collections/ConcurrentLongHashSetTest.java b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/collections/ConcurrentLongHashSetTest.java
new file mode 100644
index 0000000..24337f1
--- /dev/null
+++ b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/collections/ConcurrentLongHashSetTest.java
@@ -0,0 +1,249 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.activemq.artemis.utils.collections;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class ConcurrentLongHashSetTest {
+
+   @Test
+   public void simpleInsertions() {
+      ConcurrentLongHashSet set = new ConcurrentLongHashSet(16);
+
+      assertTrue(set.isEmpty());
+      assertTrue(set.add(1));
+      assertFalse(set.isEmpty());
+
+      assertTrue(set.add(2));
+      assertTrue(set.add(3));
+
+      assertEquals(set.size(), 3);
+
+      assertTrue(set.contains(1));
+      assertEquals(set.size(), 3);
+
+      assertTrue(set.remove(1));
+      assertEquals(set.size(), 2);
+      assertFalse(set.contains(1));
+      assertFalse(set.contains(5));
+      assertEquals(set.size(), 2);
+
+      assertTrue(set.add(1));
+      assertEquals(set.size(), 3);
+      assertFalse(set.add(1));
+      assertEquals(set.size(), 3);
+   }
+
+   @Test
+   public void testRemove() {
+      ConcurrentLongHashSet set = new ConcurrentLongHashSet();
+
+      assertTrue(set.isEmpty());
+      assertTrue(set.add(1));
+      assertFalse(set.isEmpty());
+
+      assertFalse(set.remove(0));
+      assertFalse(set.isEmpty());
+      assertTrue(set.remove(1));
+      assertTrue(set.isEmpty());
+   }
+
+   @Test
+   public void testRehashing() {
+      int n = 16;
+      ConcurrentLongHashSet set = new ConcurrentLongHashSet(n / 2, 1);
+      assertEquals(set.capacity(), n);
+      assertEquals(set.size(), 0);
+
+      for (int i = 0; i < n; i++) {
+         set.add(i);
+      }
+
+      assertEquals(set.capacity(), 2 * n);
+      assertEquals(set.size(), n);
+   }
+
+   @Test
+   public void testRehashingWithDeletes() {
+      int n = 16;
+      ConcurrentLongHashSet set = new ConcurrentLongHashSet(n / 2, 1);
+      assertEquals(set.capacity(), n);
+      assertEquals(set.size(), 0);
+
+      for (int i = 0; i < n / 2; i++) {
+         set.add(i);
+      }
+
+      for (int i = 0; i < n / 2; i++) {
+         set.remove(i);
+      }
+
+      for (int i = n; i < (2 * n); i++) {
+         set.add(i);
+      }
+
+      assertEquals(set.capacity(), 2 * n);
+      assertEquals(set.size(), n);
+   }
+
+   @Test
+   public void concurrentInsertions() throws Throwable {
+      ConcurrentLongHashSet set = new ConcurrentLongHashSet();
+      ExecutorService executor = Executors.newCachedThreadPool();
+
+      final int nThreads = 16;
+      final int N = 100_000;
+
+      List<Future<?>> futures = new ArrayList<>();
+      for (int i = 0; i < nThreads; i++) {
+         final int threadIdx = i;
+
+         futures.add(executor.submit(() -> {
+            Random random = new Random();
+
+            for (int j = 0; j < N; j++) {
+               long key = Math.abs(random.nextLong());
+               // Ensure keys are unique
+               key -= key % (threadIdx + 1);
+
+               set.add(key);
+            }
+         }));
+      }
+
+      for (Future<?> future : futures) {
+         future.get();
+      }
+
+      assertEquals(set.size(), N * nThreads);
+
+      executor.shutdown();
+   }
+
+   @Test
+   public void concurrentInsertionsAndReads() throws Throwable {
+      ConcurrentLongHashSet map = new ConcurrentLongHashSet();
+      ExecutorService executor = Executors.newCachedThreadPool();
+
+      final int nThreads = 16;
+      final int N = 100_000;
+
+      List<Future<?>> futures = new ArrayList<>();
+      for (int i = 0; i < nThreads; i++) {
+         final int threadIdx = i;
+
+         futures.add(executor.submit(() -> {
+            Random random = new Random();
+
+            for (int j = 0; j < N; j++) {
+               long key = Math.abs(random.nextLong());
+               // Ensure keys are unique
+               key -= key % (threadIdx + 1);
+
+               map.add(key);
+            }
+         }));
+      }
+
+      for (Future<?> future : futures) {
+         future.get();
+      }
+
+      assertEquals(map.size(), N * nThreads);
+
+      executor.shutdown();
+   }
+
+   @Test
+   public void testIteration() {
+      ConcurrentLongHashSet set = new ConcurrentLongHashSet();
+
+      assertEquals(set.items(), Collections.emptySet());
+
+      set.add(0L);
+
+      assertEquals(set.items(), Sets.newHashSet(0L));
+
+      set.remove(0L);
+
+      assertEquals(set.items(), Collections.emptySet());
+
+      set.add(0L);
+      set.add(1L);
+      set.add(2L);
+
+      List<Long> values = Lists.newArrayList(set.items());
+      Collections.sort(values);
+      assertEquals(values, Lists.newArrayList(0L, 1L, 2L));
+
+      set.clear();
+      assertTrue(set.isEmpty());
+   }
+
+   @Test
+   public void testHashConflictWithDeletion() {
+      final int Buckets = 16;
+      ConcurrentLongHashSet set = new ConcurrentLongHashSet(Buckets, 1);
+
+      // Pick 2 keys that fall into the same bucket
+      long key1 = 1;
+      long key2 = 27;
+
+      int bucket1 = ConcurrentLongHashSet.signSafeMod(ConcurrentLongHashSet.hash(key1), Buckets);
+      int bucket2 = ConcurrentLongHashSet.signSafeMod(ConcurrentLongHashSet.hash(key2), Buckets);
+      assertEquals(bucket1, bucket2);
+
+      assertTrue(set.add(key1));
+      assertTrue(set.add(key2));
+      assertEquals(set.size(), 2);
+
+      assertTrue(set.remove(key1));
+      assertEquals(set.size(), 1);
+
+      assertTrue(set.add(key1));
+      assertEquals(set.size(), 2);
+
+      assertTrue(set.remove(key1));
+      assertEquals(set.size(), 1);
+
+      assertFalse(set.add(key2));
+      assertTrue(set.contains(key2));
+
+      assertEquals(set.size(), 1);
+      assertTrue(set.remove(key2));
+      assertTrue(set.isEmpty());
+   }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c1d55aa8/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/AbstractJournalUpdateTask.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/AbstractJournalUpdateTask.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/AbstractJournalUpdateTask.java
index 943077c..8de3da6 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/AbstractJournalUpdateTask.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/AbstractJournalUpdateTask.java
@@ -19,7 +19,6 @@ package org.apache.activemq.artemis.core.journal.impl;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Set;
 
 import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
 import org.apache.activemq.artemis.api.core.ActiveMQBuffers;
@@ -30,7 +29,7 @@ import org.apache.activemq.artemis.core.journal.EncoderPersister;
 import org.apache.activemq.artemis.core.journal.impl.dataformat.ByteArrayEncoding;
 import org.apache.activemq.artemis.core.journal.impl.dataformat.JournalAddRecord;
 import org.apache.activemq.artemis.core.journal.impl.dataformat.JournalInternalRecord;
-import org.apache.activemq.artemis.utils.ConcurrentHashSet;
+import org.apache.activemq.artemis.utils.collections.ConcurrentLongHashSet;
 
 /**
  * Super class for Journal maintenances such as clean up and Compactor
@@ -56,7 +55,7 @@ public abstract class AbstractJournalUpdateTask implements JournalReaderCallback
 
    private ActiveMQBuffer writingChannel;
 
-   private final Set<Long> recordsSnapshot = new ConcurrentHashSet<>();
+   private final ConcurrentLongHashSet recordsSnapshot;
 
    protected final List<JournalFile> newDataFiles = new ArrayList<>();
 
@@ -67,14 +66,14 @@ public abstract class AbstractJournalUpdateTask implements JournalReaderCallback
    protected AbstractJournalUpdateTask(final SequentialFileFactory fileFactory,
                                        final JournalImpl journal,
                                        final JournalFilesRepository filesRepository,
-                                       final Set<Long> recordsSnapshot,
+                                       final ConcurrentLongHashSet recordsSnapshot,
                                        final long nextOrderingID) {
       super();
       this.journal = journal;
       this.filesRepository = filesRepository;
       this.fileFactory = fileFactory;
       this.nextOrderingID = nextOrderingID;
-      this.recordsSnapshot.addAll(recordsSnapshot);
+      this.recordsSnapshot = recordsSnapshot;
    }
 
    // Public --------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c1d55aa8/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/FileWrapperJournal.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/FileWrapperJournal.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/FileWrapperJournal.java
index 8e5ca2c..5ef240a 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/FileWrapperJournal.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/FileWrapperJournal.java
@@ -18,8 +18,6 @@ package org.apache.activemq.artemis.core.journal.impl;
 
 import java.util.List;
 import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.locks.ReentrantLock;
 
@@ -43,6 +41,7 @@ import org.apache.activemq.artemis.core.journal.impl.dataformat.JournalDeleteRec
 import org.apache.activemq.artemis.core.journal.impl.dataformat.JournalDeleteRecordTX;
 import org.apache.activemq.artemis.core.journal.impl.dataformat.JournalInternalRecord;
 import org.apache.activemq.artemis.core.journal.impl.dataformat.JournalRollbackRecordTX;
+import org.apache.activemq.artemis.utils.collections.ConcurrentLongHashMap;
 
 /**
  * Journal used at a replicating backup server during the synchronization of data with the 'live'
@@ -54,7 +53,7 @@ public final class FileWrapperJournal extends JournalBase {
 
    private final ReentrantLock lockAppend = new ReentrantLock();
 
-   private final ConcurrentMap<Long, AtomicInteger> transactions = new ConcurrentHashMap<>();
+   private final ConcurrentLongHashMap<AtomicInteger> transactions = new ConcurrentLongHashMap<>();
    private final JournalImpl journal;
    protected volatile JournalFile currentFile;
 
@@ -181,7 +180,7 @@ public final class FileWrapperJournal extends JournalBase {
                                   IOCompletion callback,
                                   boolean lineUpContext) throws Exception {
       JournalInternalRecord commitRecord = new JournalCompleteRecordTX(TX_RECORD_TYPE.COMMIT, txID, null);
-      AtomicInteger value = transactions.remove(Long.valueOf(txID));
+      AtomicInteger value = transactions.remove(txID);
       if (value != null) {
          commitRecord.setNumberOfRecords(value.get());
       }
@@ -195,7 +194,7 @@ public final class FileWrapperJournal extends JournalBase {
                                    boolean sync,
                                    IOCompletion callback) throws Exception {
       JournalInternalRecord prepareRecord = new JournalCompleteRecordTX(TX_RECORD_TYPE.PREPARE, txID, transactionData);
-      AtomicInteger value = transactions.get(Long.valueOf(txID));
+      AtomicInteger value = transactions.get(txID);
       if (value != null) {
          prepareRecord.setNumberOfRecords(value.get());
       }
@@ -204,7 +203,7 @@ public final class FileWrapperJournal extends JournalBase {
 
    private int count(long txID) throws ActiveMQException {
       AtomicInteger defaultValue = new AtomicInteger(1);
-      AtomicInteger count = transactions.putIfAbsent(Long.valueOf(txID), defaultValue);
+      AtomicInteger count = transactions.putIfAbsent(txID, defaultValue);
       if (count != null) {
          return count.incrementAndGet();
       }
@@ -219,7 +218,7 @@ public final class FileWrapperJournal extends JournalBase {
    @Override
    public void appendRollbackRecord(long txID, boolean sync, IOCompletion callback) throws Exception {
       JournalInternalRecord rollbackRecord = new JournalRollbackRecordTX(txID);
-      AtomicInteger value = transactions.remove(Long.valueOf(txID));
+      AtomicInteger value = transactions.remove(txID);
       if (value != null) {
          rollbackRecord.setNumberOfRecords(value.get());
       }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c1d55aa8/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalCompactor.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalCompactor.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalCompactor.java
index 8b89c3e..e3e1e7b 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalCompactor.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalCompactor.java
@@ -18,12 +18,8 @@ package org.apache.activemq.artemis.core.journal.impl;
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
 import org.apache.activemq.artemis.api.core.ActiveMQBuffers;
@@ -41,6 +37,8 @@ import org.apache.activemq.artemis.core.journal.impl.dataformat.JournalDeleteRec
 import org.apache.activemq.artemis.core.journal.impl.dataformat.JournalInternalRecord;
 import org.apache.activemq.artemis.core.journal.impl.dataformat.JournalRollbackRecordTX;
 import org.apache.activemq.artemis.journal.ActiveMQJournalLogger;
+import org.apache.activemq.artemis.utils.collections.ConcurrentLongHashMap;
+import org.apache.activemq.artemis.utils.collections.ConcurrentLongHashSet;
 import org.jboss.logging.Logger;
 
 public class JournalCompactor extends AbstractJournalUpdateTask implements JournalRecordProvider {
@@ -53,11 +51,11 @@ public class JournalCompactor extends AbstractJournalUpdateTask implements Journ
    private static final short COMPACT_SPLIT_LINE = 2;
 
    // Snapshot of transactions that were pending when the compactor started
-   private final Map<Long, PendingTransaction> pendingTransactions = new ConcurrentHashMap<>();
+   private final ConcurrentLongHashMap<PendingTransaction> pendingTransactions = new ConcurrentLongHashMap<>();
 
-   private final Map<Long, JournalRecord> newRecords = new HashMap<>();
+   private final ConcurrentLongHashMap<JournalRecord> newRecords = new ConcurrentLongHashMap<>();
 
-   private final Map<Long, JournalTransaction> newTransactions = new HashMap<>();
+   private final ConcurrentLongHashMap<JournalTransaction> newTransactions = new ConcurrentLongHashMap<>();
 
    /**
     * Commands that happened during compacting
@@ -120,18 +118,18 @@ public class JournalCompactor extends AbstractJournalUpdateTask implements Journ
       return newDataFiles;
    }
 
-   public Map<Long, JournalRecord> getNewRecords() {
+   public ConcurrentLongHashMap<JournalRecord> getNewRecords() {
       return newRecords;
    }
 
-   public Map<Long, JournalTransaction> getNewTransactions() {
+   public ConcurrentLongHashMap<JournalTransaction> getNewTransactions() {
       return newTransactions;
    }
 
    public JournalCompactor(final SequentialFileFactory fileFactory,
                            final JournalImpl journal,
                            final JournalFilesRepository filesRepository,
-                           final Set<Long> recordsSnapshot,
+                           final ConcurrentLongHashSet recordsSnapshot,
                            final long firstFileID) {
       super(fileFactory, journal, filesRepository, recordsSnapshot, firstFileID);
    }
@@ -628,7 +626,7 @@ public class JournalCompactor extends AbstractJournalUpdateTask implements Journ
    }
 
    @Override
-   public Map<Long, JournalRecord> getRecords() {
+   public ConcurrentLongHashMap<JournalRecord> getRecords() {
       return newRecords;
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c1d55aa8/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java
index 81ae9c0..1758999 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java
@@ -31,8 +31,6 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Executor;
 import java.util.concurrent.RejectedExecutionException;
@@ -74,6 +72,8 @@ import org.apache.activemq.artemis.journal.ActiveMQJournalBundle;
 import org.apache.activemq.artemis.journal.ActiveMQJournalLogger;
 import org.apache.activemq.artemis.utils.ActiveMQThreadFactory;
 import org.apache.activemq.artemis.utils.ConcurrentHashSet;
+import org.apache.activemq.artemis.utils.collections.ConcurrentLongHashMap;
+import org.apache.activemq.artemis.utils.collections.ConcurrentLongHashSet;
 import org.apache.activemq.artemis.utils.DataConstants;
 import org.apache.activemq.artemis.utils.ExecutorFactory;
 import org.apache.activemq.artemis.utils.OrderedExecutorFactory;
@@ -168,12 +168,12 @@ public class JournalImpl extends JournalBase implements TestableJournal, Journal
    private final JournalFilesRepository filesRepository;
 
    // Compacting may replace this structure
-   private final ConcurrentMap<Long, JournalRecord> records = new ConcurrentHashMap<>();
+   private final ConcurrentLongHashMap<JournalRecord> records = new ConcurrentLongHashMap<>();
 
-   private final Set<Long> pendingRecords = new ConcurrentHashSet<>();
+   private final ConcurrentLongHashSet pendingRecords = new ConcurrentLongHashSet();
 
    // Compacting may replace this structure
-   private final ConcurrentMap<Long, JournalTransaction> transactions = new ConcurrentHashMap<>();
+   private final ConcurrentLongHashMap<JournalTransaction> transactions = new ConcurrentLongHashMap<>();
 
    // This will be set only while the JournalCompactor is being executed
    private volatile JournalCompactor compactor;
@@ -345,7 +345,7 @@ public class JournalImpl extends JournalBase implements TestableJournal, Journal
    }
 
    @Override
-   public Map<Long, JournalRecord> getRecords() {
+   public ConcurrentLongHashMap<JournalRecord> getRecords() {
       return records;
    }
 
@@ -1487,12 +1487,12 @@ public class JournalImpl extends JournalBase implements TestableJournal, Journal
                   return;
                }
 
-               compactor = new JournalCompactor(fileFactory, this, filesRepository, records.keySet(), dataFilesToProcess.get(0).getFileID());
+               compactor = new JournalCompactor(fileFactory, this, filesRepository, records.keysLongHashSet(), dataFilesToProcess.get(0).getFileID());
 
-               for (Map.Entry<Long, JournalTransaction> entry : transactions.entrySet()) {
-                  compactor.addPendingTransaction(entry.getKey(), entry.getValue().getPositiveArray());
-                  entry.getValue().setCompacting();
-               }
+               transactions.forEach((id, pendingTransaction) -> {
+                  compactor.addPendingTransaction(id, pendingTransaction.getPositiveArray());
+                  pendingTransaction.setCompacting();
+               });
 
                // We will calculate the new records during compacting, what will take the position the records will take
                // after compacting
@@ -1540,9 +1540,9 @@ public class JournalImpl extends JournalBase implements TestableJournal, Journal
                newDatafiles = localCompactor.getNewDataFiles();
 
                // Restore newRecords created during compacting
-               for (Map.Entry<Long, JournalRecord> newRecordEntry : localCompactor.getNewRecords().entrySet()) {
-                  records.put(newRecordEntry.getKey(), newRecordEntry.getValue());
-               }
+               localCompactor.getNewRecords().forEach((id, newRecord) -> {
+                  records.put(id, newRecord);
+               });
 
                // Restore compacted dataFiles
                for (int i = newDatafiles.size() - 1; i >= 0; i--) {
@@ -1559,9 +1559,7 @@ public class JournalImpl extends JournalBase implements TestableJournal, Journal
 
                // Replay pending commands (including updates, deletes and commits)
 
-               for (JournalTransaction newTransaction : localCompactor.getNewTransactions().values()) {
-                  newTransaction.replaceRecordProvider(this);
-               }
+               localCompactor.getNewTransactions().forEach((id, newTransaction) -> newTransaction.replaceRecordProvider(this));
 
                localCompactor.replayPendingCommands();
 
@@ -1569,7 +1567,7 @@ public class JournalImpl extends JournalBase implements TestableJournal, Journal
                // This has to be done after the replay pending commands, as we need to delete commits
                // that happened during the compacting
 
-               for (JournalTransaction newTransaction : localCompactor.getNewTransactions().values()) {
+               localCompactor.getNewTransactions().forEach((id, newTransaction) -> {
                   if (logger.isTraceEnabled()) {
                      logger.trace("Merging pending transaction " + newTransaction + " after compacting the journal");
                   }
@@ -1579,7 +1577,7 @@ public class JournalImpl extends JournalBase implements TestableJournal, Journal
                   } else {
                      ActiveMQJournalLogger.LOGGER.compactMergeError(newTransaction.getId());
                   }
-               }
+               });
             } finally {
                journalLock.writeLock().unlock();
             }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c1d55aa8/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalRecordProvider.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalRecordProvider.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalRecordProvider.java
index 6c5107a..c9c92f4 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalRecordProvider.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalRecordProvider.java
@@ -16,7 +16,7 @@
  */
 package org.apache.activemq.artemis.core.journal.impl;
 
-import java.util.Map;
+import org.apache.activemq.artemis.utils.collections.ConcurrentLongHashMap;
 
 /**
  * This is an interface used only internally.
@@ -29,5 +29,5 @@ public interface JournalRecordProvider {
 
    JournalCompactor getCompactor();
 
-   Map<Long, JournalRecord> getRecords();
+   ConcurrentLongHashMap<JournalRecord> getRecords();
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c1d55aa8/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationEndpoint.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationEndpoint.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationEndpoint.java
index 4bf2726..6f899f3 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationEndpoint.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationEndpoint.java
@@ -371,7 +371,7 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon
     * @throws Exception
     */
    private void handleReplicationSynchronization(ReplicationSyncFileMessage msg) throws Exception {
-      Long id = Long.valueOf(msg.getId());
+      long id = msg.getId();
       byte[] data = msg.getData();
       SequentialFile channel1;
       switch (msg.getFileType()) {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c1d55aa8/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/JournalCleanupCompactStressTest.java
----------------------------------------------------------------------
diff --git a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/JournalCleanupCompactStressTest.java b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/JournalCleanupCompactStressTest.java
index c08f1dd..7493949 100644
--- a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/JournalCleanupCompactStressTest.java
+++ b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/JournalCleanupCompactStressTest.java
@@ -18,7 +18,6 @@ package org.apache.activemq.artemis.tests.stress.journal;
 
 import java.io.File;
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Executor;
@@ -238,12 +237,15 @@ public class JournalCleanupCompactStressTest extends ActiveMQTestBase {
 
       reloadJournal();
 
-      Collection<Long> records = journal.getRecords().keySet();
-
       System.out.println("Deleting everything!");
-      for (Long delInfo : records) {
-         journal.appendDeleteRecord(delInfo, false);
-      }
+
+      journal.getRecords().forEach((id, record) -> {
+         try {
+            journal.appendDeleteRecord(id, false);
+         } catch (Exception e) {
+            new RuntimeException(e);
+         }
+      });
 
       journal.forceMoveNextFile();
 

Reply | Threaded
Open this post in threaded view
|

[5/6] activemq-artemis git commit: ARTEMIS-1156 Adding deprecated TypedProperties extending new location

clebertsuconic-2
ARTEMIS-1156 Adding deprecated TypedProperties extending new location

We recently moved TypedProperties under ./util/collections
This is exposed through Messages so we added this as a deprecated option.

We also had to add this class on a separate commit from dc26ac96b4b24b5caa8a14db24b25b6f7e8026d9
to preserve git history on the new one.


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/f1f4d4de
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/f1f4d4de
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/f1f4d4de

Branch: refs/heads/master
Commit: f1f4d4dec343b58173cf7bc0fc78984665238eaf
Parents: dc26ac9
Author: Clebert Suconic <[hidden email]>
Authored: Fri May 12 10:02:51 2017 -0400
Committer: Clebert Suconic <[hidden email]>
Committed: Fri May 12 10:06:20 2017 -0400

----------------------------------------------------------------------
 .../activemq/artemis/utils/TypedProperties.java | 26 ++++++++++++++++++++
 1 file changed, 26 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f1f4d4de/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/TypedProperties.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/TypedProperties.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/TypedProperties.java
new file mode 100644
index 0000000..29cf834
--- /dev/null
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/TypedProperties.java
@@ -0,0 +1,26 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.artemis.utils;
+
+/**
+ * @deprecated Use {@link org.apache.activemq.artemis.utils.collections.TypedProperties instead}
+ */
+@Deprecated
+public class TypedProperties extends org.apache.activemq.artemis.utils.collections.TypedProperties {
+
+}

Reply | Threaded
Open this post in threaded view
|

[6/6] activemq-artemis git commit: This closes #1263

clebertsuconic-2
In reply to this post by clebertsuconic-2
This closes #1263


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/5e6687e0
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/5e6687e0
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/5e6687e0

Branch: refs/heads/master
Commit: 5e6687e0e2d1cd1f18ff74842863cbc9d22d06b7
Parents: b7b79e5 f1f4d4d
Author: Clebert Suconic <[hidden email]>
Authored: Fri May 12 10:06:43 2017 -0400
Committer: Clebert Suconic <[hidden email]>
Committed: Fri May 12 10:06:43 2017 -0400

----------------------------------------------------------------------
 .../artemis/cli/process/ProcessBuilder.java     |   2 +-
 .../artemis/core/server/NetworkHealthCheck.java |   2 +-
 .../artemis/utils/ConcurrentHashSet.java        |  81 --
 .../activemq/artemis/utils/ConcurrentSet.java   |  29 -
 .../activemq/artemis/utils/DataConstants.java   |   2 +-
 .../activemq/artemis/utils/TypedProperties.java | 923 +-----------------
 .../utils/collections/ConcurrentHashSet.java    |  81 ++
 .../collections/ConcurrentLongHashMap.java      | 504 ++++++++++
 .../collections/ConcurrentLongHashSet.java      | 423 +++++++++
 .../utils/collections/ConcurrentSet.java        |  29 +
 .../artemis/utils/collections/LinkedList.java   |  32 +
 .../utils/collections/LinkedListImpl.java       | 390 ++++++++
 .../utils/collections/LinkedListIterator.java   |  32 +
 .../utils/collections/PriorityLinkedList.java   |  38 +
 .../collections/PriorityLinkedListImpl.java     | 248 +++++
 .../utils/collections/TypedProperties.java      | 939 +++++++++++++++++++
 ...uentPropertyBeanIntrospectorWithIgnores.java |   2 +-
 .../artemis/utils/ConcurrentHashSetTest.java    |   2 +
 .../utils/TypedPropertiesConversionTest.java    |   1 +
 .../artemis/utils/TypedPropertiesTest.java      |   1 +
 .../collections/ConcurrentLongHashMapTest.java  | 405 ++++++++
 .../collections/ConcurrentLongHashSetTest.java  | 249 +++++
 .../core/client/impl/ClientConsumerImpl.java    |   4 +-
 .../core/client/impl/ClientMessageImpl.java     |   2 +-
 .../core/client/impl/ClientMessageInternal.java |   2 +-
 .../client/impl/ClientSessionFactoryImpl.java   |   2 +-
 .../artemis/core/cluster/DiscoveryGroup.java    |   2 +-
 .../artemis/core/message/impl/CoreMessage.java  |   2 +-
 .../core/server/management/Notification.java    |   2 +-
 .../activemq/artemis/reader/MapMessageUtil.java |   2 +-
 .../activemq/artemis/utils/LinkedList.java      |  32 -
 .../activemq/artemis/utils/LinkedListImpl.java  | 390 --------
 .../artemis/utils/LinkedListIterator.java       |  32 -
 .../artemis/utils/PriorityLinkedList.java       |  38 -
 .../artemis/utils/PriorityLinkedListImpl.java   | 248 -----
 .../util/TimeAndCounterIDGeneratorTest.java     |   2 +-
 .../store/file/JDBCSequentialFileFactory.java   |   2 +-
 .../artemis/jms/client/ActiveMQConnection.java  |   2 +-
 .../artemis/jms/client/ActiveMQJMSProducer.java |   2 +-
 .../artemis/jms/client/ActiveMQMapMessage.java  |   2 +-
 .../artemis/jms/client/ThreadAwareContext.java  |   2 +-
 .../jms/server/impl/JMSServerManagerImpl.java   |   4 +-
 .../journal/impl/AbstractJournalUpdateTask.java |   9 +-
 .../core/journal/impl/FileWrapperJournal.java   |  13 +-
 .../core/journal/impl/JournalCompactor.java     |  20 +-
 .../artemis/core/journal/impl/JournalImpl.java  |  40 +-
 .../journal/impl/JournalRecordProvider.java     |   4 +-
 .../amqp/converter/jms/ServerJMSMapMessage.java |   2 +-
 .../protocol/mqtt/MQTTConnectionManager.java    |   2 +-
 .../protocol/mqtt/MQTTRetainMessageManager.java |   2 +-
 .../protocol/openwire/OpenWireConnection.java   |   2 +-
 .../openwire/OpenWireMessageConverter.java      |   2 +-
 .../artemis/ra/ActiveMQRAConnectionManager.java |   2 +-
 .../artemis/ra/recovery/RecoveryManager.java    |   2 +-
 .../impl/ActiveMQServerControlImpl.java         |   4 +-
 .../core/management/impl/QueueControlImpl.java  |   2 +-
 .../core/paging/cursor/PageIterator.java        |   2 +-
 .../core/paging/cursor/PageSubscription.java    |   2 +-
 .../cursor/impl/PageSubscriptionImpl.java       |   2 +-
 .../activemq/artemis/core/paging/impl/Page.java |   2 +-
 .../core/paging/impl/PagingManagerImpl.java     |   2 +-
 .../impl/journal/LargeServerMessageImpl.java    |   2 +-
 .../core/postoffice/impl/PostOfficeImpl.java    |   2 +-
 .../core/remoting/impl/invm/InVMAcceptor.java   |   2 +-
 .../core/remoting/impl/netty/NettyAcceptor.java |   2 +-
 .../core/replication/ReplicationEndpoint.java   |   2 +-
 .../core/security/impl/SecurityStoreImpl.java   |   4 +-
 .../activemq/artemis/core/server/Queue.java     |   2 +-
 .../core/server/cluster/ClusterManager.java     |   2 +-
 .../core/server/cluster/impl/BridgeImpl.java    |   2 +-
 .../server/cluster/impl/BroadcastGroupImpl.java |   2 +-
 .../cluster/impl/ClusterConnectionImpl.java     |   4 +-
 .../group/impl/GroupHandlingAbstract.java       |   2 +-
 .../server/group/impl/LocalGroupingHandler.java |   2 +-
 .../group/impl/RemoteGroupingHandler.java       |   4 +-
 .../core/server/impl/ActiveMQServerImpl.java    |   7 +-
 .../artemis/core/server/impl/QueueImpl.java     |  10 +-
 .../core/server/impl/ScaleDownHandler.java      |   2 +-
 .../core/server/impl/ServerConsumerImpl.java    |   4 +-
 .../core/server/impl/ServerSessionImpl.java     |  15 +-
 .../management/impl/ManagementServiceImpl.java  |   4 +-
 .../core/list/PriorityLinkedListTest.java       |   4 +-
 .../group/impl/ClusteredResetMockTest.java      |   2 +-
 .../impl/ScheduledDeliveryHandlerTest.java      |   2 +-
 etc/findbugs-exclude.xml                        |   2 +-
 .../tests/integration/client/ConsumerTest.java  |   2 +-
 .../integration/client/SlowConsumerTest.java    |   4 +-
 .../integration/cluster/bridge/BridgeTest.java  |   5 +-
 .../integration/mqtt/imported/MQTTFQQNTest.java |   2 +-
 .../integration/mqtt/imported/MQTTTest.java     |   2 +-
 .../integration/paging/PagingSendTest.java      |   2 +-
 .../integration/plugin/MqttPluginTest.java      |  32 +-
 .../JournalCleanupCompactStressTest.java        |  14 +-
 .../stress/paging/PageCursorStressTest.java     |   2 +-
 .../unit/core/postoffice/impl/FakeQueue.java    |   5 +-
 .../unit/core/server/impl/QueueImplTest.java    |   2 +-
 .../artemis/tests/unit/util/LinkedListTest.java |   4 +-
 97 files changed, 3536 insertions(+), 1931 deletions(-)
----------------------------------------------------------------------


Reply | Threaded
Open this post in threaded view
|

[4/6] activemq-artemis git commit: ARTEMIS-1156: moving our collections on its own package

clebertsuconic-2
In reply to this post by clebertsuconic-2
ARTEMIS-1156: moving our collections on its own package


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/dc26ac96
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/dc26ac96
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/dc26ac96

Branch: refs/heads/master
Commit: dc26ac96b4b24b5caa8a14db24b25b6f7e8026d9
Parents: c1d55aa
Author: Clebert Suconic <[hidden email]>
Authored: Fri May 12 10:00:15 2017 -0400
Committer: Clebert Suconic <[hidden email]>
Committed: Fri May 12 10:06:05 2017 -0400

----------------------------------------------------------------------
 .../artemis/cli/process/ProcessBuilder.java     |   2 +-
 .../artemis/core/server/NetworkHealthCheck.java |   2 +-
 .../artemis/utils/ConcurrentHashSet.java        |  81 --
 .../activemq/artemis/utils/ConcurrentSet.java   |  29 -
 .../activemq/artemis/utils/DataConstants.java   |   2 +-
 .../activemq/artemis/utils/TypedProperties.java | 937 ------------------
 .../utils/collections/ConcurrentHashSet.java    |  81 ++
 .../utils/collections/ConcurrentSet.java        |  29 +
 .../artemis/utils/collections/LinkedList.java   |  32 +
 .../utils/collections/LinkedListImpl.java       | 390 ++++++++
 .../utils/collections/LinkedListIterator.java   |  32 +
 .../utils/collections/PriorityLinkedList.java   |  38 +
 .../collections/PriorityLinkedListImpl.java     | 248 +++++
 .../utils/collections/TypedProperties.java      | 939 +++++++++++++++++++
 ...uentPropertyBeanIntrospectorWithIgnores.java |   2 +-
 .../artemis/utils/ConcurrentHashSetTest.java    |   2 +
 .../utils/TypedPropertiesConversionTest.java    |   1 +
 .../artemis/utils/TypedPropertiesTest.java      |   1 +
 .../core/client/impl/ClientConsumerImpl.java    |   4 +-
 .../core/client/impl/ClientMessageImpl.java     |   2 +-
 .../core/client/impl/ClientMessageInternal.java |   2 +-
 .../client/impl/ClientSessionFactoryImpl.java   |   2 +-
 .../artemis/core/cluster/DiscoveryGroup.java    |   2 +-
 .../artemis/core/message/impl/CoreMessage.java  |   2 +-
 .../core/server/management/Notification.java    |   2 +-
 .../activemq/artemis/reader/MapMessageUtil.java |   2 +-
 .../activemq/artemis/utils/LinkedList.java      |  32 -
 .../activemq/artemis/utils/LinkedListImpl.java  | 390 --------
 .../artemis/utils/LinkedListIterator.java       |  32 -
 .../artemis/utils/PriorityLinkedList.java       |  38 -
 .../artemis/utils/PriorityLinkedListImpl.java   | 248 -----
 .../util/TimeAndCounterIDGeneratorTest.java     |   2 +-
 .../store/file/JDBCSequentialFileFactory.java   |   2 +-
 .../artemis/jms/client/ActiveMQConnection.java  |   2 +-
 .../artemis/jms/client/ActiveMQJMSProducer.java |   2 +-
 .../artemis/jms/client/ActiveMQMapMessage.java  |   2 +-
 .../artemis/jms/client/ThreadAwareContext.java  |   2 +-
 .../jms/server/impl/JMSServerManagerImpl.java   |   4 +-
 .../artemis/core/journal/impl/JournalImpl.java  |   8 +-
 .../amqp/converter/jms/ServerJMSMapMessage.java |   2 +-
 .../protocol/mqtt/MQTTConnectionManager.java    |   2 +-
 .../protocol/mqtt/MQTTRetainMessageManager.java |   2 +-
 .../protocol/openwire/OpenWireConnection.java   |   2 +-
 .../openwire/OpenWireMessageConverter.java      |   2 +-
 .../artemis/ra/ActiveMQRAConnectionManager.java |   2 +-
 .../artemis/ra/recovery/RecoveryManager.java    |   2 +-
 .../impl/ActiveMQServerControlImpl.java         |   4 +-
 .../core/management/impl/QueueControlImpl.java  |   2 +-
 .../core/paging/cursor/PageIterator.java        |   2 +-
 .../core/paging/cursor/PageSubscription.java    |   2 +-
 .../cursor/impl/PageSubscriptionImpl.java       |   2 +-
 .../activemq/artemis/core/paging/impl/Page.java |   2 +-
 .../core/paging/impl/PagingManagerImpl.java     |   2 +-
 .../impl/journal/LargeServerMessageImpl.java    |   2 +-
 .../core/postoffice/impl/PostOfficeImpl.java    |   2 +-
 .../core/remoting/impl/invm/InVMAcceptor.java   |   2 +-
 .../core/remoting/impl/netty/NettyAcceptor.java |   2 +-
 .../core/security/impl/SecurityStoreImpl.java   |   4 +-
 .../activemq/artemis/core/server/Queue.java     |   2 +-
 .../core/server/cluster/ClusterManager.java     |   2 +-
 .../core/server/cluster/impl/BridgeImpl.java    |   2 +-
 .../server/cluster/impl/BroadcastGroupImpl.java |   2 +-
 .../cluster/impl/ClusterConnectionImpl.java     |   4 +-
 .../group/impl/GroupHandlingAbstract.java       |   2 +-
 .../server/group/impl/LocalGroupingHandler.java |   2 +-
 .../group/impl/RemoteGroupingHandler.java       |   4 +-
 .../core/server/impl/ActiveMQServerImpl.java    |   7 +-
 .../artemis/core/server/impl/QueueImpl.java     |  10 +-
 .../core/server/impl/ScaleDownHandler.java      |   2 +-
 .../core/server/impl/ServerConsumerImpl.java    |   4 +-
 .../core/server/impl/ServerSessionImpl.java     |  15 +-
 .../management/impl/ManagementServiceImpl.java  |   4 +-
 .../core/list/PriorityLinkedListTest.java       |   4 +-
 .../group/impl/ClusteredResetMockTest.java      |   2 +-
 .../impl/ScheduledDeliveryHandlerTest.java      |   2 +-
 etc/findbugs-exclude.xml                        |   2 +-
 .../tests/integration/client/ConsumerTest.java  |   2 +-
 .../integration/client/SlowConsumerTest.java    |   4 +-
 .../integration/cluster/bridge/BridgeTest.java  |   5 +-
 .../integration/mqtt/imported/MQTTFQQNTest.java |   2 +-
 .../integration/mqtt/imported/MQTTTest.java     |   2 +-
 .../integration/paging/PagingSendTest.java      |   2 +-
 .../integration/plugin/MqttPluginTest.java      |  32 +-
 .../stress/paging/PageCursorStressTest.java     |   2 +-
 .../unit/core/postoffice/impl/FakeQueue.java    |   5 +-
 .../unit/core/server/impl/QueueImplTest.java    |   2 +-
 .../artemis/tests/unit/util/LinkedListTest.java |   4 +-
 87 files changed, 1904 insertions(+), 1902 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/process/ProcessBuilder.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/process/ProcessBuilder.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/process/ProcessBuilder.java
index 5e4acf4..9eb7960 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/process/ProcessBuilder.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/process/ProcessBuilder.java
@@ -22,7 +22,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 
-import org.apache.activemq.artemis.utils.ConcurrentHashSet;
+import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
 
 public class ProcessBuilder {
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/NetworkHealthCheck.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/NetworkHealthCheck.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/NetworkHealthCheck.java
index cabd045..eef79a1 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/NetworkHealthCheck.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/NetworkHealthCheck.java
@@ -33,7 +33,7 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.activemq.artemis.logs.ActiveMQUtilLogger;
 import org.apache.activemq.artemis.utils.ActiveMQThreadFactory;
-import org.apache.activemq.artemis.utils.ConcurrentHashSet;
+import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
 import org.jboss.logging.Logger;
 
 /**

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ConcurrentHashSet.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ConcurrentHashSet.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ConcurrentHashSet.java
deleted file mode 100644
index 1b4e5d7..0000000
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ConcurrentHashSet.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.artemis.utils;
-
-import java.util.AbstractSet;
-import java.util.Iterator;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-/**
- * A ConcurrentHashSet.
- *
- * Offers same concurrency as ConcurrentHashMap but for a Set
- */
-public class ConcurrentHashSet<E> extends AbstractSet<E> implements ConcurrentSet<E> {
-
-   private final ConcurrentMap<E, Object> theMap;
-
-   private static final Object dummy = new Object();
-
-   public ConcurrentHashSet() {
-      theMap = new ConcurrentHashMap<>();
-   }
-
-   @Override
-   public int size() {
-      return theMap.size();
-   }
-
-   @Override
-   public Iterator<E> iterator() {
-      return theMap.keySet().iterator();
-   }
-
-   @Override
-   public boolean isEmpty() {
-      return theMap.isEmpty();
-   }
-
-   @Override
-   public boolean add(final E o) {
-      return theMap.put(o, ConcurrentHashSet.dummy) == null;
-   }
-
-   @Override
-   public boolean contains(final Object o) {
-      return theMap.containsKey(o);
-   }
-
-   @Override
-   public void clear() {
-      theMap.clear();
-   }
-
-   @Override
-   public boolean remove(final Object o) {
-      return theMap.remove(o) == ConcurrentHashSet.dummy;
-   }
-
-   @Override
-   public boolean addIfAbsent(final E o) {
-      Object obj = theMap.putIfAbsent(o, ConcurrentHashSet.dummy);
-
-      return obj == null;
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ConcurrentSet.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ConcurrentSet.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ConcurrentSet.java
deleted file mode 100644
index e55be24..0000000
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ConcurrentSet.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.artemis.utils;
-
-import java.util.Set;
-
-/**
- * A ConcurrentSet
- *
- * @param <E> The generic class
- */
-public interface ConcurrentSet<E> extends Set<E> {
-
-   boolean addIfAbsent(E o);
-}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/DataConstants.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/DataConstants.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/DataConstants.java
index 38df9b6..5b2b365 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/DataConstants.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/DataConstants.java
@@ -32,7 +32,7 @@ public final class DataConstants {
 
    public static final int SIZE_FLOAT = 4;
 
-   static final int SIZE_CHAR = 2;
+   public static final int SIZE_CHAR = 2;
 
    public static final byte TRUE = 1;
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/TypedProperties.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/TypedProperties.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/TypedProperties.java
deleted file mode 100644
index fda135b..0000000
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/TypedProperties.java
+++ /dev/null
@@ -1,937 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.artemis.utils;
-
-import java.nio.ByteBuffer;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import io.netty.buffer.ByteBuf;
-import org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException;
-import org.apache.activemq.artemis.api.core.SimpleString;
-import org.apache.activemq.artemis.logs.ActiveMQUtilBundle;
-
-import static org.apache.activemq.artemis.utils.DataConstants.BOOLEAN;
-import static org.apache.activemq.artemis.utils.DataConstants.BYTE;
-import static org.apache.activemq.artemis.utils.DataConstants.BYTES;
-import static org.apache.activemq.artemis.utils.DataConstants.CHAR;
-import static org.apache.activemq.artemis.utils.DataConstants.DOUBLE;
-import static org.apache.activemq.artemis.utils.DataConstants.FLOAT;
-import static org.apache.activemq.artemis.utils.DataConstants.INT;
-import static org.apache.activemq.artemis.utils.DataConstants.LONG;
-import static org.apache.activemq.artemis.utils.DataConstants.NULL;
-import static org.apache.activemq.artemis.utils.DataConstants.SHORT;
-import static org.apache.activemq.artemis.utils.DataConstants.STRING;
-
-/**
- * Property Value Conversion.
- * <p>
- * This implementation follows section 3.5.4 of the <i>Java Message Service</i> specification
- * (Version 1.1 April 12, 2002).
- * <p>
- */
-public final class TypedProperties {
-
-   private static final SimpleString AMQ_PROPNAME = new SimpleString("_AMQ_");
-
-   private Map<SimpleString, PropertyValue> properties;
-
-   private volatile int size;
-
-   private boolean internalProperties;
-
-   public TypedProperties() {
-   }
-
-   /**
-    *  Return the number of properites
-    * */
-   public int size() {
-      return properties.size();
-   }
-
-   public int getMemoryOffset() {
-      // The estimate is basically the encode size + 2 object references for each entry in the map
-      // Note we don't include the attributes or anything else since they already included in the memory estimate
-      // of the ServerMessage
-
-      return properties == null ? 0 : size + 2 * DataConstants.SIZE_INT * properties.size();
-   }
-
-   public TypedProperties(final TypedProperties other) {
-      properties = other.properties == null ? null : new HashMap<>(other.properties);
-      size = other.size;
-   }
-
-   public boolean hasInternalProperties() {
-      return internalProperties;
-   }
-
-   public void putBooleanProperty(final SimpleString key, final boolean value) {
-      checkCreateProperties();
-      doPutValue(key, new BooleanValue(value));
-   }
-
-   public void putByteProperty(final SimpleString key, final byte value) {
-      checkCreateProperties();
-      doPutValue(key, new ByteValue(value));
-   }
-
-   public void putBytesProperty(final SimpleString key, final byte[] value) {
-      checkCreateProperties();
-      doPutValue(key, value == null ? new NullValue() : new BytesValue(value));
-   }
-
-   public void putShortProperty(final SimpleString key, final short value) {
-      checkCreateProperties();
-      doPutValue(key, new ShortValue(value));
-   }
-
-   public void putIntProperty(final SimpleString key, final int value) {
-      checkCreateProperties();
-      doPutValue(key, new IntValue(value));
-   }
-
-   public void putLongProperty(final SimpleString key, final long value) {
-      checkCreateProperties();
-      doPutValue(key, new LongValue(value));
-   }
-
-   public void putFloatProperty(final SimpleString key, final float value) {
-      checkCreateProperties();
-      doPutValue(key, new FloatValue(value));
-   }
-
-   public void putDoubleProperty(final SimpleString key, final double value) {
-      checkCreateProperties();
-      doPutValue(key, new DoubleValue(value));
-   }
-
-   public void putSimpleStringProperty(final SimpleString key, final SimpleString value) {
-      checkCreateProperties();
-      doPutValue(key, value == null ? new NullValue() : new StringValue(value));
-   }
-
-   public void putNullValue(final SimpleString key) {
-      checkCreateProperties();
-      doPutValue(key, new NullValue());
-   }
-
-   public void putCharProperty(final SimpleString key, final char value) {
-      checkCreateProperties();
-      doPutValue(key, new CharValue(value));
-   }
-
-   public void putTypedProperties(final TypedProperties otherProps) {
-      if (otherProps == null || otherProps.properties == null) {
-         return;
-      }
-
-      checkCreateProperties();
-      Set<Entry<SimpleString, PropertyValue>> otherEntries = otherProps.properties.entrySet();
-      for (Entry<SimpleString, PropertyValue> otherEntry : otherEntries) {
-         doPutValue(otherEntry.getKey(), otherEntry.getValue());
-      }
-   }
-
-   public Object getProperty(final SimpleString key) {
-      return doGetProperty(key);
-   }
-
-   public Boolean getBooleanProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
-      Object value = doGetProperty(key);
-      if (value == null) {
-         return Boolean.valueOf(null);
-      } else if (value instanceof Boolean) {
-         return (Boolean) value;
-      } else if (value instanceof SimpleString) {
-         return Boolean.valueOf(((SimpleString) value).toString());
-      }
-      throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
-   }
-
-   public Byte getByteProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
-      Object value = doGetProperty(key);
-      if (value == null) {
-         return Byte.valueOf(null);
-      } else if (value instanceof Byte) {
-         return (Byte) value;
-      } else if (value instanceof SimpleString) {
-         return Byte.parseByte(((SimpleString) value).toString());
-      }
-      throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
-   }
-
-   public Character getCharProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
-      Object value = doGetProperty(key);
-      if (value == null) {
-         throw new NullPointerException("Invalid conversion: " + key);
-      }
-
-      if (value instanceof Character) {
-         return ((Character) value);
-      }
-      throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
-   }
-
-   public byte[] getBytesProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
-      Object value = doGetProperty(key);
-      if (value == null) {
-         return null;
-      } else if (value instanceof byte[]) {
-         return (byte[]) value;
-      }
-      throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
-   }
-
-   public Double getDoubleProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
-      Object value = doGetProperty(key);
-      if (value == null) {
-         return Double.valueOf(null);
-      } else if (value instanceof Float) {
-         return ((Float) value).doubleValue();
-      } else if (value instanceof Double) {
-         return (Double) value;
-      } else if (value instanceof SimpleString) {
-         return Double.parseDouble(((SimpleString) value).toString());
-      }
-      throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
-   }
-
-   public Integer getIntProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
-      Object value = doGetProperty(key);
-      if (value == null) {
-         return Integer.valueOf(null);
-      } else if (value instanceof Integer) {
-         return (Integer) value;
-      } else if (value instanceof Byte) {
-         return ((Byte) value).intValue();
-      } else if (value instanceof Short) {
-         return ((Short) value).intValue();
-      } else if (value instanceof SimpleString) {
-         return Integer.parseInt(((SimpleString) value).toString());
-      }
-      throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
-   }
-
-   public Long getLongProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
-      Object value = doGetProperty(key);
-      if (value == null) {
-         return Long.valueOf(null);
-      } else if (value instanceof Long) {
-         return (Long) value;
-      } else if (value instanceof Byte) {
-         return ((Byte) value).longValue();
-      } else if (value instanceof Short) {
-         return ((Short) value).longValue();
-      } else if (value instanceof Integer) {
-         return ((Integer) value).longValue();
-      } else if (value instanceof SimpleString) {
-         return Long.parseLong(((SimpleString) value).toString());
-      }
-      throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
-   }
-
-   public Short getShortProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
-      Object value = doGetProperty(key);
-      if (value == null) {
-         return Short.valueOf(null);
-      } else if (value instanceof Byte) {
-         return ((Byte) value).shortValue();
-      } else if (value instanceof Short) {
-         return (Short) value;
-      } else if (value instanceof SimpleString) {
-         return Short.parseShort(((SimpleString) value).toString());
-      }
-      throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
-   }
-
-   public Float getFloatProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
-      Object value = doGetProperty(key);
-      if (value == null)
-         return Float.valueOf(null);
-      if (value instanceof Float) {
-         return ((Float) value);
-      }
-      if (value instanceof SimpleString) {
-         return Float.parseFloat(((SimpleString) value).toString());
-      }
-      throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
-   }
-
-   public SimpleString getSimpleStringProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
-      Object value = doGetProperty(key);
-
-      if (value == null) {
-         return null;
-      }
-
-      if (value instanceof SimpleString) {
-         return (SimpleString) value;
-      } else if (value instanceof Boolean) {
-         return new SimpleString(value.toString());
-      } else if (value instanceof Character) {
-         return new SimpleString(value.toString());
-      } else if (value instanceof Byte) {
-         return new SimpleString(value.toString());
-      } else if (value instanceof Short) {
-         return new SimpleString(value.toString());
-      } else if (value instanceof Integer) {
-         return new SimpleString(value.toString());
-      } else if (value instanceof Long) {
-         return new SimpleString(value.toString());
-      } else if (value instanceof Float) {
-         return new SimpleString(value.toString());
-      } else if (value instanceof Double) {
-         return new SimpleString(value.toString());
-      }
-      throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
-   }
-
-   public Object removeProperty(final SimpleString key) {
-      return doRemoveProperty(key);
-   }
-
-   public boolean containsProperty(final SimpleString key) {
-      if (size == 0) {
-         return false;
-
-      } else {
-         return properties.containsKey(key);
-      }
-   }
-
-   public Set<SimpleString> getPropertyNames() {
-      if (size == 0) {
-         return Collections.emptySet();
-      } else {
-         return properties.keySet();
-      }
-   }
-
-   public synchronized void decode(final ByteBuf buffer) {
-      byte b = buffer.readByte();
-
-      if (b == DataConstants.NULL) {
-         properties = null;
-      } else {
-         int numHeaders = buffer.readInt();
-
-         properties = new HashMap<>(numHeaders);
-         size = 0;
-
-         for (int i = 0; i < numHeaders; i++) {
-            int len = buffer.readInt();
-            byte[] data = new byte[len];
-            buffer.readBytes(data);
-            SimpleString key = new SimpleString(data);
-
-            byte type = buffer.readByte();
-
-            PropertyValue val;
-
-            switch (type) {
-               case NULL: {
-                  val = new NullValue();
-                  doPutValue(key, val);
-                  break;
-               }
-               case CHAR: {
-                  val = new CharValue(buffer);
-                  doPutValue(key, val);
-                  break;
-               }
-               case BOOLEAN: {
-                  val = new BooleanValue(buffer);
-                  doPutValue(key, val);
-                  break;
-               }
-               case BYTE: {
-                  val = new ByteValue(buffer);
-                  doPutValue(key, val);
-                  break;
-               }
-               case BYTES: {
-                  val = new BytesValue(buffer);
-                  doPutValue(key, val);
-                  break;
-               }
-               case SHORT: {
-                  val = new ShortValue(buffer);
-                  doPutValue(key, val);
-                  break;
-               }
-               case INT: {
-                  val = new IntValue(buffer);
-                  doPutValue(key, val);
-                  break;
-               }
-               case LONG: {
-                  val = new LongValue(buffer);
-                  doPutValue(key, val);
-                  break;
-               }
-               case FLOAT: {
-                  val = new FloatValue(buffer);
-                  doPutValue(key, val);
-                  break;
-               }
-               case DOUBLE: {
-                  val = new DoubleValue(buffer);
-                  doPutValue(key, val);
-                  break;
-               }
-               case STRING: {
-                  val = new StringValue(buffer);
-                  doPutValue(key, val);
-                  break;
-               }
-               default: {
-                  throw ActiveMQUtilBundle.BUNDLE.invalidType(type);
-               }
-            }
-         }
-      }
-   }
-
-   public synchronized void encode(final ByteBuf buffer) {
-      if (properties == null) {
-         buffer.writeByte(DataConstants.NULL);
-      } else {
-         buffer.writeByte(DataConstants.NOT_NULL);
-
-         buffer.writeInt(properties.size());
-
-         for (Map.Entry<SimpleString, PropertyValue> entry : properties.entrySet()) {
-            SimpleString s = entry.getKey();
-            byte[] data = s.getData();
-            buffer.writeInt(data.length);
-            buffer.writeBytes(data);
-
-            entry.getValue().write(buffer);
-         }
-      }
-   }
-
-   public int getEncodeSize() {
-      if (properties == null) {
-         return DataConstants.SIZE_BYTE;
-      } else {
-         return DataConstants.SIZE_BYTE + DataConstants.SIZE_INT + size;
-      }
-   }
-
-   public void clear() {
-      if (properties != null) {
-         properties.clear();
-      }
-   }
-
-   @Override
-   public String toString() {
-      StringBuilder sb = new StringBuilder("TypedProperties[");
-
-      if (properties != null) {
-
-         Iterator<Entry<SimpleString, PropertyValue>> iter = properties.entrySet().iterator();
-
-         while (iter.hasNext()) {
-            Entry<SimpleString, PropertyValue> iterItem = iter.next();
-            sb.append(iterItem.getKey() + "=");
-
-            // it seems weird but it's right!!
-            // The first getValue is from the EntrySet
-            // The second is to convert the PropertyValue into the actual value
-            Object theValue = iterItem.getValue().getValue();
-
-            if (theValue == null) {
-               sb.append("NULL-value");
-            } else if (theValue instanceof byte[]) {
-               sb.append("[" + ByteUtil.maxString(ByteUtil.bytesToHex((byte[]) theValue, 2), 150) + ")");
-
-               if (iterItem.getKey().toString().startsWith("_AMQ_ROUTE_TO")) {
-                  sb.append(",bytesAsLongs(");
-                  try {
-                     ByteBuffer buff = ByteBuffer.wrap((byte[]) theValue);
-                     while (buff.hasRemaining()) {
-                        long bindingID = buff.getLong();
-                        sb.append(bindingID);
-                        if (buff.hasRemaining()) {
-                           sb.append(",");
-                        }
-                     }
-                  } catch (Throwable e) {
-                     sb.append("error-converting-longs=" + e.getMessage());
-                  }
-                  sb.append("]");
-               }
-            } else {
-               sb.append(theValue.toString());
-            }
-
-            if (iter.hasNext()) {
-               sb.append(",");
-            }
-         }
-      }
-
-      return sb.append("]").toString();
-   }
-
-   // Private ------------------------------------------------------------------------------------
-
-   private void checkCreateProperties() {
-      if (properties == null) {
-         properties = new HashMap<>();
-      }
-   }
-
-   private synchronized void doPutValue(final SimpleString key, final PropertyValue value) {
-      if (key.startsWith(AMQ_PROPNAME)) {
-         internalProperties = true;
-      }
-
-      PropertyValue oldValue = properties.put(key, value);
-      if (oldValue != null) {
-         size += value.encodeSize() - oldValue.encodeSize();
-      } else {
-         size += SimpleString.sizeofString(key) + value.encodeSize();
-      }
-   }
-
-   private synchronized Object doRemoveProperty(final SimpleString key) {
-      if (properties == null) {
-         return null;
-      }
-
-      PropertyValue val = properties.remove(key);
-
-      if (val == null) {
-         return null;
-      } else {
-         size -= SimpleString.sizeofString(key) + val.encodeSize();
-
-         return val.getValue();
-      }
-   }
-
-   private synchronized Object doGetProperty(final Object key) {
-      if (size == 0) {
-         return null;
-      }
-
-      PropertyValue val = properties.get(key);
-
-      if (val == null) {
-         return null;
-      } else {
-         return val.getValue();
-      }
-   }
-
-   // Inner classes ------------------------------------------------------------------------------
-
-   private abstract static class PropertyValue {
-
-      abstract Object getValue();
-
-      abstract void write(ByteBuf buffer);
-
-      abstract int encodeSize();
-
-      @Override
-      public String toString() {
-         return "" + getValue();
-      }
-   }
-
-   private static final class NullValue extends PropertyValue {
-
-      private NullValue() {
-      }
-
-      @Override
-      public Object getValue() {
-         return null;
-      }
-
-      @Override
-      public void write(final ByteBuf buffer) {
-         buffer.writeByte(DataConstants.NULL);
-      }
-
-      @Override
-      public int encodeSize() {
-         return DataConstants.SIZE_BYTE;
-      }
-
-   }
-
-   private static final class BooleanValue extends PropertyValue {
-
-      final boolean val;
-
-      private BooleanValue(final boolean val) {
-         this.val = val;
-      }
-
-      private BooleanValue(final ByteBuf buffer) {
-         val = buffer.readBoolean();
-      }
-
-      @Override
-      public Object getValue() {
-         return val;
-      }
-
-      @Override
-      public void write(final ByteBuf buffer) {
-         buffer.writeByte(DataConstants.BOOLEAN);
-         buffer.writeBoolean(val);
-      }
-
-      @Override
-      public int encodeSize() {
-         return DataConstants.SIZE_BYTE + DataConstants.SIZE_BOOLEAN;
-      }
-
-   }
-
-   private static final class ByteValue extends PropertyValue {
-
-      final byte val;
-
-      private ByteValue(final byte val) {
-         this.val = val;
-      }
-
-      private ByteValue(final ByteBuf buffer) {
-         val = buffer.readByte();
-      }
-
-      @Override
-      public Object getValue() {
-         return val;
-      }
-
-      @Override
-      public void write(final ByteBuf buffer) {
-         buffer.writeByte(DataConstants.BYTE);
-         buffer.writeByte(val);
-      }
-
-      @Override
-      public int encodeSize() {
-         return DataConstants.SIZE_BYTE + DataConstants.SIZE_BYTE;
-      }
-   }
-
-   private static final class BytesValue extends PropertyValue {
-
-      final byte[] val;
-
-      private BytesValue(final byte[] val) {
-         this.val = val;
-      }
-
-      private BytesValue(final ByteBuf buffer) {
-         int len = buffer.readInt();
-         val = new byte[len];
-         buffer.readBytes(val);
-      }
-
-      @Override
-      public Object getValue() {
-         return val;
-      }
-
-      @Override
-      public void write(final ByteBuf buffer) {
-         buffer.writeByte(DataConstants.BYTES);
-         buffer.writeInt(val.length);
-         buffer.writeBytes(val);
-      }
-
-      @Override
-      public int encodeSize() {
-         return DataConstants.SIZE_BYTE + DataConstants.SIZE_INT + val.length;
-      }
-
-   }
-
-   private static final class ShortValue extends PropertyValue {
-
-      final short val;
-
-      private ShortValue(final short val) {
-         this.val = val;
-      }
-
-      private ShortValue(final ByteBuf buffer) {
-         val = buffer.readShort();
-      }
-
-      @Override
-      public Object getValue() {
-         return val;
-      }
-
-      @Override
-      public void write(final ByteBuf buffer) {
-         buffer.writeByte(DataConstants.SHORT);
-         buffer.writeShort(val);
-      }
-
-      @Override
-      public int encodeSize() {
-         return DataConstants.SIZE_BYTE + DataConstants.SIZE_SHORT;
-      }
-   }
-
-   private static final class IntValue extends PropertyValue {
-
-      final int val;
-
-      private IntValue(final int val) {
-         this.val = val;
-      }
-
-      private IntValue(final ByteBuf buffer) {
-         val = buffer.readInt();
-      }
-
-      @Override
-      public Object getValue() {
-         return val;
-      }
-
-      @Override
-      public void write(final ByteBuf buffer) {
-         buffer.writeByte(DataConstants.INT);
-         buffer.writeInt(val);
-      }
-
-      @Override
-      public int encodeSize() {
-         return DataConstants.SIZE_BYTE + DataConstants.SIZE_INT;
-      }
-   }
-
-   private static final class LongValue extends PropertyValue {
-
-      final long val;
-
-      private LongValue(final long val) {
-         this.val = val;
-      }
-
-      private LongValue(final ByteBuf buffer) {
-         val = buffer.readLong();
-      }
-
-      @Override
-      public Object getValue() {
-         return val;
-      }
-
-      @Override
-      public void write(final ByteBuf buffer) {
-         buffer.writeByte(DataConstants.LONG);
-         buffer.writeLong(val);
-      }
-
-      @Override
-      public int encodeSize() {
-         return DataConstants.SIZE_BYTE + DataConstants.SIZE_LONG;
-      }
-   }
-
-   private static final class FloatValue extends PropertyValue {
-
-      final float val;
-
-      private FloatValue(final float val) {
-         this.val = val;
-      }
-
-      private FloatValue(final ByteBuf buffer) {
-         val = Float.intBitsToFloat(buffer.readInt());
-      }
-
-      @Override
-      public Object getValue() {
-         return val;
-      }
-
-      @Override
-      public void write(final ByteBuf buffer) {
-         buffer.writeByte(DataConstants.FLOAT);
-         buffer.writeInt(Float.floatToIntBits(val));
-      }
-
-      @Override
-      public int encodeSize() {
-         return DataConstants.SIZE_BYTE + DataConstants.SIZE_FLOAT;
-      }
-
-   }
-
-   private static final class DoubleValue extends PropertyValue {
-
-      final double val;
-
-      private DoubleValue(final double val) {
-         this.val = val;
-      }
-
-      private DoubleValue(final ByteBuf buffer) {
-         val = Double.longBitsToDouble(buffer.readLong());
-      }
-
-      @Override
-      public Object getValue() {
-         return val;
-      }
-
-      @Override
-      public void write(final ByteBuf buffer) {
-         buffer.writeByte(DataConstants.DOUBLE);
-         buffer.writeLong(Double.doubleToLongBits(val));
-      }
-
-      @Override
-      public int encodeSize() {
-         return DataConstants.SIZE_BYTE + DataConstants.SIZE_DOUBLE;
-      }
-   }
-
-   private static final class CharValue extends PropertyValue {
-
-      final char val;
-
-      private CharValue(final char val) {
-         this.val = val;
-      }
-
-      private CharValue(final ByteBuf buffer) {
-         val = (char) buffer.readShort();
-      }
-
-      @Override
-      public Object getValue() {
-         return val;
-      }
-
-      @Override
-      public void write(final ByteBuf buffer) {
-         buffer.writeByte(DataConstants.CHAR);
-         buffer.writeShort((short) val);
-      }
-
-      @Override
-      public int encodeSize() {
-         return DataConstants.SIZE_BYTE + DataConstants.SIZE_CHAR;
-      }
-   }
-
-   private static final class StringValue extends PropertyValue {
-
-      final SimpleString val;
-
-      private StringValue(final SimpleString val) {
-         this.val = val;
-      }
-
-      private StringValue(final ByteBuf buffer) {
-         val = SimpleString.readSimpleString(buffer);
-      }
-
-      @Override
-      public Object getValue() {
-         return val;
-      }
-
-      @Override
-      public void write(final ByteBuf buffer) {
-         buffer.writeByte(DataConstants.STRING);
-         SimpleString.writeSimpleString(buffer, val);
-      }
-
-      @Override
-      public int encodeSize() {
-         return DataConstants.SIZE_BYTE + SimpleString.sizeofString(val);
-      }
-   }
-
-   public boolean isEmpty() {
-      return properties.isEmpty();
-   }
-
-   public Map<String, Object> getMap() {
-      Map<String, Object> m = new HashMap<>();
-      for (Entry<SimpleString, PropertyValue> entry : properties.entrySet()) {
-         Object val = entry.getValue().getValue();
-         if (val instanceof SimpleString) {
-            m.put(entry.getKey().toString(), ((SimpleString) val).toString());
-         } else {
-            m.put(entry.getKey().toString(), val);
-         }
-      }
-      return m;
-   }
-
-   /**
-    * Helper for MapMessage#setObjectProperty(String, Object)
-    *
-    * @param key        The SimpleString key
-    * @param value      The Object value
-    * @param properties The typed properties
-    */
-   public static void setObjectProperty(final SimpleString key, final Object value, final TypedProperties properties) {
-      if (value == null) {
-         properties.putNullValue(key);
-      } else if (value instanceof Boolean) {
-         properties.putBooleanProperty(key, (Boolean) value);
-      } else if (value instanceof Byte) {
-         properties.putByteProperty(key, (Byte) value);
-      } else if (value instanceof Character) {
-         properties.putCharProperty(key, (Character) value);
-      } else if (value instanceof Short) {
-         properties.putShortProperty(key, (Short) value);
-      } else if (value instanceof Integer) {
-         properties.putIntProperty(key, (Integer) value);
-      } else if (value instanceof Long) {
-         properties.putLongProperty(key, (Long) value);
-      } else if (value instanceof Float) {
-         properties.putFloatProperty(key, (Float) value);
-      } else if (value instanceof Double) {
-         properties.putDoubleProperty(key, (Double) value);
-      } else if (value instanceof String) {
-         properties.putSimpleStringProperty(key, new SimpleString((String) value));
-      } else if (value instanceof SimpleString) {
-         properties.putSimpleStringProperty(key, (SimpleString) value);
-      } else if (value instanceof byte[]) {
-         properties.putBytesProperty(key, (byte[]) value);
-      } else {
-         throw new ActiveMQPropertyConversionException(value.getClass() + " is not a valid property type");
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java
new file mode 100644
index 0000000..21c1588
--- /dev/null
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.utils.collections;
+
+import java.util.AbstractSet;
+import java.util.Iterator;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * A ConcurrentHashSet.
+ *
+ * Offers same concurrency as ConcurrentHashMap but for a Set
+ */
+public class ConcurrentHashSet<E> extends AbstractSet<E> implements ConcurrentSet<E> {
+
+   private final ConcurrentMap<E, Object> theMap;
+
+   private static final Object dummy = new Object();
+
+   public ConcurrentHashSet() {
+      theMap = new ConcurrentHashMap<>();
+   }
+
+   @Override
+   public int size() {
+      return theMap.size();
+   }
+
+   @Override
+   public Iterator<E> iterator() {
+      return theMap.keySet().iterator();
+   }
+
+   @Override
+   public boolean isEmpty() {
+      return theMap.isEmpty();
+   }
+
+   @Override
+   public boolean add(final E o) {
+      return theMap.put(o, ConcurrentHashSet.dummy) == null;
+   }
+
+   @Override
+   public boolean contains(final Object o) {
+      return theMap.containsKey(o);
+   }
+
+   @Override
+   public void clear() {
+      theMap.clear();
+   }
+
+   @Override
+   public boolean remove(final Object o) {
+      return theMap.remove(o) == ConcurrentHashSet.dummy;
+   }
+
+   @Override
+   public boolean addIfAbsent(final E o) {
+      Object obj = theMap.putIfAbsent(o, ConcurrentHashSet.dummy);
+
+      return obj == null;
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentSet.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentSet.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentSet.java
new file mode 100644
index 0000000..bab7aa3
--- /dev/null
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentSet.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.utils.collections;
+
+import java.util.Set;
+
+/**
+ * A ConcurrentSet
+ *
+ * @param <E> The generic class
+ */
+public interface ConcurrentSet<E> extends Set<E> {
+
+   boolean addIfAbsent(E o);
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/LinkedList.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/LinkedList.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/LinkedList.java
new file mode 100644
index 0000000..3a77c42
--- /dev/null
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/LinkedList.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.utils.collections;
+
+public interface LinkedList<E> {
+
+   void addHead(E e);
+
+   void addTail(E e);
+
+   E poll();
+
+   LinkedListIterator<E> iterator();
+
+   void clear();
+
+   int size();
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/LinkedListImpl.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/LinkedListImpl.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/LinkedListImpl.java
new file mode 100644
index 0000000..81b5d60
--- /dev/null
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/LinkedListImpl.java
@@ -0,0 +1,390 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.utils.collections;
+
+import java.lang.reflect.Array;
+import java.util.NoSuchElementException;
+
+/**
+ * A linked list implementation which allows multiple iterators to exist at the same time on the queue, and which see any
+ * elements added or removed from the queue either directly or via iterators.
+ *
+ * This class is not thread safe.
+ */
+public class LinkedListImpl<E> implements LinkedList<E> {
+
+   private static final int INITIAL_ITERATOR_ARRAY_SIZE = 10;
+
+   private final Node<E> head = new Node<>(null);
+
+   private Node<E> tail = null;
+
+   private int size;
+
+   // We store in an array rather than a Map for the best performance
+   private volatile Iterator[] iters;
+
+   private int numIters;
+
+   private int nextIndex;
+
+   public LinkedListImpl() {
+      iters = createIteratorArray(INITIAL_ITERATOR_ARRAY_SIZE);
+   }
+
+   @Override
+   public void addHead(E e) {
+      Node<E> node = new Node<>(e);
+
+      node.next = head.next;
+
+      node.prev = head;
+
+      head.next = node;
+
+      if (size == 0) {
+         tail = node;
+      } else {
+         // Need to set the previous element on the former head
+         node.next.prev = node;
+      }
+
+      size++;
+   }
+
+   @Override
+   public void addTail(E e) {
+      if (size == 0) {
+         addHead(e);
+      } else {
+         Node<E> node = new Node<>(e);
+
+         node.prev = tail;
+
+         tail.next = node;
+
+         tail = node;
+
+         size++;
+      }
+   }
+
+   @Override
+   public E poll() {
+      Node<E> ret = head.next;
+
+      if (ret != null) {
+         removeAfter(head);
+
+         return ret.val;
+      } else {
+         return null;
+      }
+   }
+
+   @Override
+   public void clear() {
+      tail = head.next = null;
+
+      size = 0;
+   }
+
+   @Override
+   public int size() {
+      return size;
+   }
+
+   @Override
+   public LinkedListIterator<E> iterator() {
+      return new Iterator();
+   }
+
+   @Override
+   public String toString() {
+      StringBuilder str = new StringBuilder("LinkedListImpl [ ");
+
+      Node<E> node = head;
+
+      while (node != null) {
+         str.append(node.toString());
+
+         if (node.next != null) {
+            str.append(", ");
+         }
+
+         node = node.next;
+      }
+
+      return str.toString();
+   }
+
+   public int numIters() {
+      return numIters;
+   }
+
+   private Iterator[] createIteratorArray(int size) {
+      return (Iterator[]) Array.newInstance(Iterator.class, size);
+   }
+
+   private void removeAfter(Node<E> node) {
+      Node<E> toRemove = node.next;
+
+      node.next = toRemove.next;
+
+      if (toRemove.next != null) {
+         toRemove.next.prev = node;
+      }
+
+      if (toRemove == tail) {
+         tail = node;
+      }
+
+      size--;
+
+      if (toRemove.iterCount != 0) {
+         LinkedListImpl.this.nudgeIterators(toRemove);
+      }
+
+      //Help GC - otherwise GC potentially has to traverse a very long list to see if elements are reachable, this can result in OOM
+      //https://jira.jboss.org/browse/HORNETQ-469
+      toRemove.next = toRemove.prev = null;
+   }
+
+   private synchronized void nudgeIterators(Node<E> node) {
+      for (int i = 0; i < numIters; i++) {
+         Iterator iter = iters[i];
+         if (iter != null) {
+            iter.nudged(node);
+         }
+      }
+   }
+
+   private synchronized void addIter(Iterator iter) {
+      if (numIters == iters.length) {
+         resize(2 * numIters);
+      }
+
+      iters[nextIndex++] = iter;
+
+      numIters++;
+   }
+
+   private synchronized void resize(int newSize) {
+      Iterator[] newIters = createIteratorArray(newSize);
+
+      System.arraycopy(iters, 0, newIters, 0, numIters);
+
+      iters = newIters;
+   }
+
+   private synchronized void removeIter(Iterator iter) {
+      for (int i = 0; i < numIters; i++) {
+         if (iter == iters[i]) {
+            iters[i] = null;
+
+            if (i != numIters - 1) {
+               // Fill in the hole
+
+               System.arraycopy(iters, i + 1, iters, i, numIters - i - 1);
+            }
+
+            numIters--;
+
+            if (numIters >= INITIAL_ITERATOR_ARRAY_SIZE && numIters == iters.length / 2) {
+               resize(numIters);
+            }
+
+            nextIndex--;
+
+            return;
+         }
+      }
+
+      throw new IllegalStateException("Cannot find iter to remove");
+   }
+
+   private static final class Node<E> {
+
+      Node<E> next;
+
+      Node<E> prev;
+
+      final E val;
+
+      int iterCount;
+
+      Node(E e) {
+         val = e;
+      }
+
+      @Override
+      public String toString() {
+         return "Node, value = " + val;
+      }
+   }
+
+   private class Iterator implements LinkedListIterator<E> {
+
+      Node<E> last;
+
+      Node<E> current = head.next;
+
+      boolean repeat;
+
+      Iterator() {
+         if (current != null) {
+            current.iterCount++;
+         }
+
+         addIter(this);
+      }
+
+      @Override
+      public void repeat() {
+         repeat = true;
+      }
+
+      @Override
+      public boolean hasNext() {
+         Node<E> e = getNode();
+
+         if (e != null && (e != last || repeat)) {
+            return true;
+         }
+
+         return canAdvance();
+      }
+
+      @Override
+      public E next() {
+         Node<E> e = getNode();
+
+         if (repeat) {
+            repeat = false;
+
+            if (e != null) {
+               return e.val;
+            } else {
+               if (canAdvance()) {
+                  advance();
+
+                  e = getNode();
+
+                  return e.val;
+               } else {
+                  throw new NoSuchElementException();
+               }
+            }
+         }
+
+         if (e == null || e == last) {
+            if (canAdvance()) {
+               advance();
+
+               e = getNode();
+            } else {
+               throw new NoSuchElementException();
+            }
+         }
+
+         last = e;
+
+         repeat = false;
+
+         return e.val;
+      }
+
+      @Override
+      public void remove() {
+         if (last == null) {
+            throw new NoSuchElementException();
+         }
+
+         if (current == null) {
+            throw new NoSuchElementException();
+         }
+
+         LinkedListImpl.this.removeAfter(current.prev);
+
+         last = null;
+      }
+
+      @Override
+      public void close() {
+         removeIter(this);
+      }
+
+      public void nudged(Node<E> node) {
+         if (current == node) {
+            if (canAdvance()) {
+               advance();
+            } else {
+               if (current.prev != head) {
+                  current.iterCount--;
+
+                  current = current.prev;
+
+                  current.iterCount++;
+               } else {
+                  current = null;
+               }
+            }
+         }
+      }
+
+      private Node<E> getNode() {
+         if (current == null) {
+            current = head.next;
+
+            if (current != null) {
+               current.iterCount++;
+            }
+         }
+
+         if (current != null) {
+            return current;
+         } else {
+            return null;
+         }
+      }
+
+      private boolean canAdvance() {
+         if (current == null) {
+            current = head.next;
+
+            if (current != null) {
+               current.iterCount++;
+            }
+         }
+
+         return current != null && current.next != null;
+      }
+
+      private void advance() {
+         if (current == null || current.next == null) {
+            throw new NoSuchElementException();
+         }
+
+         current.iterCount--;
+
+         current = current.next;
+
+         current.iterCount++;
+      }
+
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/LinkedListIterator.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/LinkedListIterator.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/LinkedListIterator.java
new file mode 100644
index 0000000..62ab097
--- /dev/null
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/LinkedListIterator.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.utils.collections;
+
+import java.util.Iterator;
+
+/**
+ * A LinkedListIterator
+ *
+ * This iterator allows the last element to be repeated in the next call to hasNext or next
+ */
+public interface LinkedListIterator<E> extends Iterator<E>, AutoCloseable {
+
+   void repeat();
+
+   @Override
+   void close();
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/PriorityLinkedList.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/PriorityLinkedList.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/PriorityLinkedList.java
new file mode 100644
index 0000000..79a99f3
--- /dev/null
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/PriorityLinkedList.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.utils.collections;
+
+/**
+ * A type of linked list which maintains items according to a priority
+ * and allows adding and removing of elements at both ends, and peeking
+ */
+public interface PriorityLinkedList<T> {
+
+   void addHead(T t, int priority);
+
+   void addTail(T t, int priority);
+
+   T poll();
+
+   void clear();
+
+   int size();
+
+   LinkedListIterator<T> iterator();
+
+   boolean isEmpty();
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/PriorityLinkedListImpl.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/PriorityLinkedListImpl.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/PriorityLinkedListImpl.java
new file mode 100644
index 0000000..39d6b6d
--- /dev/null
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/PriorityLinkedListImpl.java
@@ -0,0 +1,248 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.utils.collections;
+
+import java.lang.reflect.Array;
+import java.util.NoSuchElementException;
+
+/**
+ * A priority linked list implementation
+ * <p>
+ * It implements this by maintaining an individual LinkedBlockingDeque for each priority level.
+ */
+public class PriorityLinkedListImpl<T> implements PriorityLinkedList<T> {
+
+   protected LinkedListImpl<T>[] levels;
+
+   private int size;
+
+   private int lastReset;
+
+   private int highestPriority = -1;
+
+   private int lastPriority = -1;
+
+   public PriorityLinkedListImpl(final int priorities) {
+      levels = (LinkedListImpl<T>[]) Array.newInstance(LinkedListImpl.class, priorities);
+
+      for (int i = 0; i < priorities; i++) {
+         levels[i] = new LinkedListImpl<>();
+      }
+   }
+
+   private void checkHighest(final int priority) {
+      if (lastPriority != priority || priority > highestPriority) {
+         lastPriority = priority;
+         if (lastReset == Integer.MAX_VALUE) {
+            lastReset = 0;
+         } else {
+            lastReset++;
+         }
+      }
+
+      if (priority > highestPriority) {
+         highestPriority = priority;
+      }
+   }
+
+   @Override
+   public void addHead(final T t, final int priority) {
+      checkHighest(priority);
+
+      levels[priority].addHead(t);
+
+      size++;
+   }
+
+   @Override
+   public void addTail(final T t, final int priority) {
+      checkHighest(priority);
+
+      levels[priority].addTail(t);
+
+      size++;
+   }
+
+   @Override
+   public T poll() {
+      T t = null;
+
+      // We are just using a simple prioritization algorithm:
+      // Highest priority refs always get returned first.
+      // This could cause starvation of lower priority refs.
+
+      // TODO - A better prioritization algorithm
+
+      for (int i = highestPriority; i >= 0; i--) {
+         LinkedListImpl<T> ll = levels[i];
+
+         if (ll.size() != 0) {
+            t = ll.poll();
+
+            if (t != null) {
+               size--;
+
+               if (ll.size() == 0) {
+                  if (highestPriority == i) {
+                     highestPriority--;
+                  }
+               }
+            }
+
+            break;
+         }
+      }
+
+      return t;
+   }
+
+   @Override
+   public void clear() {
+      for (LinkedListImpl<T> list : levels) {
+         list.clear();
+      }
+
+      size = 0;
+   }
+
+   @Override
+   public int size() {
+      return size;
+   }
+
+   @Override
+   public boolean isEmpty() {
+      return size == 0;
+   }
+
+   @Override
+   public LinkedListIterator<T> iterator() {
+      return new PriorityLinkedListIterator();
+   }
+
+   private class PriorityLinkedListIterator implements LinkedListIterator<T> {
+
+      private int index;
+
+      private final LinkedListIterator<T>[] cachedIters = new LinkedListIterator[levels.length];
+
+      private LinkedListIterator<T> lastIter;
+
+      private int resetCount = lastReset;
+
+      volatile boolean closed = false;
+
+      PriorityLinkedListIterator() {
+         index = levels.length - 1;
+      }
+
+      @Override
+      protected void finalize() {
+         close();
+      }
+
+      @Override
+      public void repeat() {
+         if (lastIter == null) {
+            throw new NoSuchElementException();
+         }
+
+         lastIter.repeat();
+      }
+
+      @Override
+      public void close() {
+         if (!closed) {
+            closed = true;
+            lastIter = null;
+
+            for (LinkedListIterator<T> iter : cachedIters) {
+               if (iter != null) {
+                  iter.close();
+               }
+            }
+         }
+      }
+
+      private void checkReset() {
+         if (lastReset != resetCount) {
+            index = highestPriority;
+
+            resetCount = lastReset;
+         }
+      }
+
+      @Override
+      public boolean hasNext() {
+         checkReset();
+
+         while (index >= 0) {
+            lastIter = cachedIters[index];
+
+            if (lastIter == null) {
+               lastIter = cachedIters[index] = levels[index].iterator();
+            }
+
+            boolean b = lastIter.hasNext();
+
+            if (b) {
+               return true;
+            }
+
+            index--;
+
+            if (index < 0) {
+               index = levels.length - 1;
+
+               break;
+            }
+         }
+         return false;
+      }
+
+      @Override
+      public T next() {
+         if (lastIter == null) {
+            throw new NoSuchElementException();
+         }
+
+         return lastIter.next();
+      }
+
+      @Override
+      public void remove() {
+         if (lastIter == null) {
+            throw new NoSuchElementException();
+         }
+
+         lastIter.remove();
+
+         // This next statement would be the equivalent of:
+         // if (index == highestPriority && levels[index].size() == 0)
+         // However we have to keep checking all the previous levels
+         // otherwise we would cache a max that will not exist
+         // what would make us eventually having hasNext() returning false
+         // as a bug
+         // Part of the fix for HORNETQ-705
+         for (int i = index; i >= 0 && levels[index].size() == 0; i--) {
+            highestPriority = i;
+         }
+
+         size--;
+      }
+   }
+}

Reply | Threaded
Open this post in threaded view
|

[2/6] activemq-artemis git commit: ARTEMIS-1156: moving our collections on its own package

clebertsuconic-2
In reply to this post by clebertsuconic-2
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java
index 6ed4f5b..0297ba5 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java
@@ -59,7 +59,7 @@ import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
 import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
 import org.apache.activemq.artemis.utils.Base64;
 import org.apache.activemq.artemis.utils.JsonLoader;
-import org.apache.activemq.artemis.utils.LinkedListIterator;
+import org.apache.activemq.artemis.utils.collections.LinkedListIterator;
 
 public class QueueControlImpl extends AbstractControl implements QueueControl {
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/PageIterator.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/PageIterator.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/PageIterator.java
index af6ed40..1732133 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/PageIterator.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/PageIterator.java
@@ -17,7 +17,7 @@
 
 package org.apache.activemq.artemis.core.paging.cursor;
 
-import org.apache.activemq.artemis.utils.LinkedListIterator;
+import org.apache.activemq.artemis.utils.collections.LinkedListIterator;
 
 public interface PageIterator extends LinkedListIterator<PagedReference> {
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/PageSubscription.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/PageSubscription.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/PageSubscription.java
index 6e569c1..93e2a84 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/PageSubscription.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/PageSubscription.java
@@ -23,7 +23,7 @@ import org.apache.activemq.artemis.core.paging.PagingStore;
 import org.apache.activemq.artemis.core.paging.impl.Page;
 import org.apache.activemq.artemis.core.server.Queue;
 import org.apache.activemq.artemis.core.transaction.Transaction;
-import org.apache.activemq.artemis.utils.LinkedListIterator;
+import org.apache.activemq.artemis.utils.collections.LinkedListIterator;
 
 public interface PageSubscription {
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java
index ab10eb4..f346dc0 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java
@@ -55,8 +55,8 @@ import org.apache.activemq.artemis.core.transaction.Transaction;
 import org.apache.activemq.artemis.core.transaction.TransactionOperationAbstract;
 import org.apache.activemq.artemis.core.transaction.TransactionPropertyIndexes;
 import org.apache.activemq.artemis.core.transaction.impl.TransactionImpl;
-import org.apache.activemq.artemis.utils.ConcurrentHashSet;
 import org.apache.activemq.artemis.utils.FutureLatch;
+import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
 import org.jboss.logging.Logger;
 
 final class PageSubscriptionImpl implements PageSubscription {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/Page.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/Page.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/Page.java
index 7d21316..3873292 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/Page.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/Page.java
@@ -35,8 +35,8 @@ import org.apache.activemq.artemis.core.persistence.StorageManager;
 import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle;
 import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
 import org.apache.activemq.artemis.core.server.LargeServerMessage;
-import org.apache.activemq.artemis.utils.ConcurrentHashSet;
 import org.apache.activemq.artemis.utils.DataConstants;
+import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
 import org.jboss.logging.Logger;
 
 public final class Page implements Comparable<Page> {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingManagerImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingManagerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingManagerImpl.java
index e036c16..44e8067 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingManagerImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingManagerImpl.java
@@ -37,7 +37,7 @@ import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
 import org.apache.activemq.artemis.core.server.files.FileStoreMonitor;
 import org.apache.activemq.artemis.core.settings.HierarchicalRepository;
 import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
-import org.apache.activemq.artemis.utils.ConcurrentHashSet;
+import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
 import org.jboss.logging.Logger;
 
 public final class PagingManagerImpl implements PagingManager {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/LargeServerMessageImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/LargeServerMessageImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/LargeServerMessageImpl.java
index 7d652c9..5ebcb56 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/LargeServerMessageImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/LargeServerMessageImpl.java
@@ -30,7 +30,7 @@ import org.apache.activemq.artemis.core.message.impl.CoreMessage;
 import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
 import org.apache.activemq.artemis.core.server.LargeServerMessage;
 import org.apache.activemq.artemis.utils.DataConstants;
-import org.apache.activemq.artemis.utils.TypedProperties;
+import org.apache.activemq.artemis.utils.collections.TypedProperties;
 import org.jboss.logging.Logger;
 
 public final class LargeServerMessageImpl extends CoreMessage implements LargeServerMessage {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
index a927768..4627325 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
@@ -82,8 +82,8 @@ import org.apache.activemq.artemis.core.transaction.TransactionOperation;
 import org.apache.activemq.artemis.core.transaction.TransactionOperationAbstract;
 import org.apache.activemq.artemis.core.transaction.TransactionPropertyIndexes;
 import org.apache.activemq.artemis.core.transaction.impl.TransactionImpl;
-import org.apache.activemq.artemis.utils.TypedProperties;
 import org.apache.activemq.artemis.utils.UUIDGenerator;
+import org.apache.activemq.artemis.utils.collections.TypedProperties;
 import org.jboss.logging.Logger;
 
 /**

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMAcceptor.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMAcceptor.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMAcceptor.java
index 398baa4..5cae1e5 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMAcceptor.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMAcceptor.java
@@ -39,7 +39,7 @@ import org.apache.activemq.artemis.spi.core.remoting.ServerConnectionLifeCycleLi
 import org.apache.activemq.artemis.utils.ConfigurationHelper;
 import org.apache.activemq.artemis.utils.ExecutorFactory;
 import org.apache.activemq.artemis.utils.OrderedExecutorFactory;
-import org.apache.activemq.artemis.utils.TypedProperties;
+import org.apache.activemq.artemis.utils.collections.TypedProperties;
 import org.jboss.logging.Logger;
 
 public final class InVMAcceptor extends AbstractAcceptor {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java
index 0f714c2..fa2723c 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java
@@ -82,7 +82,7 @@ import org.apache.activemq.artemis.spi.core.remoting.Connection;
 import org.apache.activemq.artemis.spi.core.remoting.ServerConnectionLifeCycleListener;
 import org.apache.activemq.artemis.utils.ActiveMQThreadFactory;
 import org.apache.activemq.artemis.utils.ConfigurationHelper;
-import org.apache.activemq.artemis.utils.TypedProperties;
+import org.apache.activemq.artemis.utils.collections.TypedProperties;
 import org.jboss.logging.Logger;
 
 /**

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-server/src/main/java/org/apache/activemq/artemis/core/security/impl/SecurityStoreImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/security/impl/SecurityStoreImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/security/impl/SecurityStoreImpl.java
index e6c8e4e..2f5f0d5 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/security/impl/SecurityStoreImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/security/impl/SecurityStoreImpl.java
@@ -36,8 +36,8 @@ import org.apache.activemq.artemis.core.settings.HierarchicalRepositoryChangeLis
 import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager;
 import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager2;
 import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager3;
-import org.apache.activemq.artemis.utils.ConcurrentHashSet;
-import org.apache.activemq.artemis.utils.TypedProperties;
+import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
+import org.apache.activemq.artemis.utils.collections.TypedProperties;
 import org.jboss.logging.Logger;
 
 /**

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/Queue.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/Queue.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/Queue.java
index d7b70a3..3404639 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/Queue.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/Queue.java
@@ -29,8 +29,8 @@ import org.apache.activemq.artemis.core.filter.Filter;
 import org.apache.activemq.artemis.core.paging.cursor.PageSubscription;
 import org.apache.activemq.artemis.core.server.impl.AckReason;
 import org.apache.activemq.artemis.core.transaction.Transaction;
-import org.apache.activemq.artemis.utils.LinkedListIterator;
 import org.apache.activemq.artemis.utils.ReferenceCounter;
+import org.apache.activemq.artemis.utils.collections.LinkedListIterator;
 
 public interface Queue extends Bindable {
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java
index 70edb68..a3f9a05 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java
@@ -62,9 +62,9 @@ import org.apache.activemq.artemis.core.server.impl.Activation;
 import org.apache.activemq.artemis.core.server.management.ManagementService;
 import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
 import org.apache.activemq.artemis.spi.core.remoting.Acceptor;
-import org.apache.activemq.artemis.utils.ConcurrentHashSet;
 import org.apache.activemq.artemis.utils.ExecutorFactory;
 import org.apache.activemq.artemis.utils.FutureLatch;
+import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
 import org.jboss.logging.Logger;
 
 /**

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BridgeImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BridgeImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BridgeImpl.java
index c1a0ccc..1e5a92b 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BridgeImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BridgeImpl.java
@@ -61,8 +61,8 @@ import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
 import org.apache.activemq.artemis.spi.core.remoting.ReadyListener;
 import org.apache.activemq.artemis.utils.FutureLatch;
 import org.apache.activemq.artemis.utils.ReusableLatch;
-import org.apache.activemq.artemis.utils.TypedProperties;
 import org.apache.activemq.artemis.utils.UUID;
+import org.apache.activemq.artemis.utils.collections.TypedProperties;
 import org.jboss.logging.Logger;
 
 /**

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BroadcastGroupImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BroadcastGroupImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BroadcastGroupImpl.java
index 4700b6d..e216a63 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BroadcastGroupImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BroadcastGroupImpl.java
@@ -34,8 +34,8 @@ import org.apache.activemq.artemis.core.server.NodeManager;
 import org.apache.activemq.artemis.core.server.cluster.BroadcastGroup;
 import org.apache.activemq.artemis.core.server.management.Notification;
 import org.apache.activemq.artemis.core.server.management.NotificationService;
-import org.apache.activemq.artemis.utils.TypedProperties;
 import org.apache.activemq.artemis.utils.UUIDGenerator;
+import org.apache.activemq.artemis.utils.collections.TypedProperties;
 import org.jboss.logging.Logger;
 
 /**

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionImpl.java
index a4dbc24..d7fcf29 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionImpl.java
@@ -32,6 +32,7 @@ import java.util.concurrent.TimeUnit;
 import org.apache.activemq.artemis.api.core.ActiveMQException;
 import org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration;
 import org.apache.activemq.artemis.api.core.Pair;
+import org.apache.activemq.artemis.api.core.RoutingType;
 import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.api.core.TransportConfiguration;
 import org.apache.activemq.artemis.api.core.client.ClientMessage;
@@ -52,7 +53,6 @@ import org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl;
 import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
-import org.apache.activemq.artemis.api.core.RoutingType;
 import org.apache.activemq.artemis.core.server.NodeManager;
 import org.apache.activemq.artemis.core.server.Queue;
 import org.apache.activemq.artemis.core.server.cluster.ActiveMQServerSideProtocolManagerFactory;
@@ -70,7 +70,7 @@ import org.apache.activemq.artemis.core.server.management.Notification;
 import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
 import org.apache.activemq.artemis.utils.ExecutorFactory;
 import org.apache.activemq.artemis.utils.FutureLatch;
-import org.apache.activemq.artemis.utils.TypedProperties;
+import org.apache.activemq.artemis.utils.collections.TypedProperties;
 import org.jboss.logging.Logger;
 
 public final class ClusterConnectionImpl implements ClusterConnection, AfterConnectInternalListener {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/GroupHandlingAbstract.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/GroupHandlingAbstract.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/GroupHandlingAbstract.java
index b68b59e..4f48eb7 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/GroupHandlingAbstract.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/GroupHandlingAbstract.java
@@ -30,7 +30,7 @@ import org.apache.activemq.artemis.core.server.group.GroupingHandler;
 import org.apache.activemq.artemis.core.server.group.UnproposalListener;
 import org.apache.activemq.artemis.core.server.management.ManagementService;
 import org.apache.activemq.artemis.core.server.management.Notification;
-import org.apache.activemq.artemis.utils.TypedProperties;
+import org.apache.activemq.artemis.utils.collections.TypedProperties;
 
 public abstract class GroupHandlingAbstract implements GroupingHandler {
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/LocalGroupingHandler.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/LocalGroupingHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/LocalGroupingHandler.java
index aa707f7..127eaf2 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/LocalGroupingHandler.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/LocalGroupingHandler.java
@@ -40,7 +40,7 @@ import org.apache.activemq.artemis.core.server.management.ManagementService;
 import org.apache.activemq.artemis.core.server.management.Notification;
 import org.apache.activemq.artemis.utils.ConcurrentUtil;
 import org.apache.activemq.artemis.utils.ExecutorFactory;
-import org.apache.activemq.artemis.utils.TypedProperties;
+import org.apache.activemq.artemis.utils.collections.TypedProperties;
 import org.jboss.logging.Logger;
 
 /**

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/RemoteGroupingHandler.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/RemoteGroupingHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/RemoteGroupingHandler.java
index 058e897..bd1d931 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/RemoteGroupingHandler.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/RemoteGroupingHandler.java
@@ -34,9 +34,9 @@ import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle;
 import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
 import org.apache.activemq.artemis.core.server.management.ManagementService;
 import org.apache.activemq.artemis.core.server.management.Notification;
-import org.apache.activemq.artemis.utils.ConcurrentHashSet;
 import org.apache.activemq.artemis.utils.ExecutorFactory;
-import org.apache.activemq.artemis.utils.TypedProperties;
+import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
+import org.apache.activemq.artemis.utils.collections.TypedProperties;
 
 /**
  * A remote Grouping handler.

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
index 57ac7bb..71c7c71 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
@@ -16,6 +16,8 @@
  */
 package org.apache.activemq.artemis.core.server.impl;
 
+import javax.management.MBeanServer;
+import javax.security.cert.X509Certificate;
 import java.io.File;
 import java.io.IOException;
 import java.io.PrintWriter;
@@ -46,9 +48,6 @@ import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import javax.management.MBeanServer;
-import javax.security.cert.X509Certificate;
-
 import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
 import org.apache.activemq.artemis.api.core.ActiveMQDeleteAddressException;
 import org.apache.activemq.artemis.api.core.Pair;
@@ -165,13 +164,13 @@ import org.apache.activemq.artemis.utils.ActiveMQThreadFactory;
 import org.apache.activemq.artemis.utils.ActiveMQThreadPoolExecutor;
 import org.apache.activemq.artemis.utils.CertificateUtil;
 import org.apache.activemq.artemis.utils.CompositeAddress;
-import org.apache.activemq.artemis.utils.ConcurrentHashSet;
 import org.apache.activemq.artemis.utils.ExecutorFactory;
 import org.apache.activemq.artemis.utils.OrderedExecutorFactory;
 import org.apache.activemq.artemis.utils.ReusableLatch;
 import org.apache.activemq.artemis.utils.SecurityFormatter;
 import org.apache.activemq.artemis.utils.TimeUtils;
 import org.apache.activemq.artemis.utils.VersionLoader;
+import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
 import org.jboss.logging.Logger;
 
 /**

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
index 8a0cda0..002e511 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
@@ -84,15 +84,15 @@ import org.apache.activemq.artemis.core.transaction.TransactionPropertyIndexes;
 import org.apache.activemq.artemis.core.transaction.impl.BindingsTransactionImpl;
 import org.apache.activemq.artemis.core.transaction.impl.TransactionImpl;
 import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
-import org.apache.activemq.artemis.utils.ConcurrentHashSet;
 import org.apache.activemq.artemis.utils.Env;
 import org.apache.activemq.artemis.utils.FutureLatch;
-import org.apache.activemq.artemis.utils.LinkedListIterator;
-import org.apache.activemq.artemis.utils.PriorityLinkedList;
-import org.apache.activemq.artemis.utils.PriorityLinkedListImpl;
 import org.apache.activemq.artemis.utils.ReferenceCounter;
 import org.apache.activemq.artemis.utils.ReusableLatch;
-import org.apache.activemq.artemis.utils.TypedProperties;
+import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
+import org.apache.activemq.artemis.utils.collections.LinkedListIterator;
+import org.apache.activemq.artemis.utils.collections.PriorityLinkedList;
+import org.apache.activemq.artemis.utils.collections.PriorityLinkedListImpl;
+import org.apache.activemq.artemis.utils.collections.TypedProperties;
 import org.jboss.logging.Logger;
 
 /**

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java
index bf0ed0b..e921cb9 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java
@@ -60,7 +60,7 @@ import org.apache.activemq.artemis.core.transaction.ResourceManager;
 import org.apache.activemq.artemis.core.transaction.Transaction;
 import org.apache.activemq.artemis.core.transaction.TransactionOperation;
 import org.apache.activemq.artemis.core.transaction.impl.TransactionImpl;
-import org.apache.activemq.artemis.utils.LinkedListIterator;
+import org.apache.activemq.artemis.utils.collections.LinkedListIterator;
 import org.jboss.logging.Logger;
 
 public class ScaleDownHandler {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java
index af8524d..efddf73 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java
@@ -59,8 +59,8 @@ import org.apache.activemq.artemis.core.transaction.impl.TransactionImpl;
 import org.apache.activemq.artemis.spi.core.protocol.SessionCallback;
 import org.apache.activemq.artemis.spi.core.remoting.ReadyListener;
 import org.apache.activemq.artemis.utils.FutureLatch;
-import org.apache.activemq.artemis.utils.LinkedListIterator;
-import org.apache.activemq.artemis.utils.TypedProperties;
+import org.apache.activemq.artemis.utils.collections.LinkedListIterator;
+import org.apache.activemq.artemis.utils.collections.TypedProperties;
 import org.jboss.logging.Logger;
 
 /**

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
index 7245843..83ff648 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
@@ -16,8 +16,10 @@
  */
 package org.apache.activemq.artemis.core.server.impl;
 
-import static org.apache.activemq.artemis.api.core.JsonUtil.nullSafe;
-
+import javax.json.JsonArrayBuilder;
+import javax.json.JsonObjectBuilder;
+import javax.transaction.xa.XAException;
+import javax.transaction.xa.Xid;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -29,11 +31,6 @@ import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicLong;
 
-import javax.json.JsonArrayBuilder;
-import javax.json.JsonObjectBuilder;
-import javax.transaction.xa.XAException;
-import javax.transaction.xa.Xid;
-
 import org.apache.activemq.artemis.Closeable;
 import org.apache.activemq.artemis.api.core.ActiveMQException;
 import org.apache.activemq.artemis.api.core.ActiveMQIOErrorException;
@@ -89,9 +86,11 @@ import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
 import org.apache.activemq.artemis.spi.core.protocol.SessionCallback;
 import org.apache.activemq.artemis.utils.JsonLoader;
 import org.apache.activemq.artemis.utils.PrefixUtil;
-import org.apache.activemq.artemis.utils.TypedProperties;
+import org.apache.activemq.artemis.utils.collections.TypedProperties;
 import org.jboss.logging.Logger;
 
+import static org.apache.activemq.artemis.api.core.JsonUtil.nullSafe;
+
 /**
  * Server side Session implementation
  */

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java
index f45aea7..54be380 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java
@@ -86,8 +86,8 @@ import org.apache.activemq.artemis.core.settings.HierarchicalRepository;
 import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
 import org.apache.activemq.artemis.core.transaction.ResourceManager;
 import org.apache.activemq.artemis.spi.core.remoting.Acceptor;
-import org.apache.activemq.artemis.utils.ConcurrentHashSet;
-import org.apache.activemq.artemis.utils.TypedProperties;
+import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
+import org.apache.activemq.artemis.utils.collections.TypedProperties;
 import org.jboss.logging.Logger;
 
 public class ManagementServiceImpl implements ManagementService {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-server/src/test/java/org/apache/activemq/artemis/core/list/PriorityLinkedListTest.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/list/PriorityLinkedListTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/list/PriorityLinkedListTest.java
index d464410..d26868c 100644
--- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/list/PriorityLinkedListTest.java
+++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/list/PriorityLinkedListTest.java
@@ -16,8 +16,8 @@
  */
 package org.apache.activemq.artemis.core.list;
 
-import org.apache.activemq.artemis.utils.LinkedListIterator;
-import org.apache.activemq.artemis.utils.PriorityLinkedListImpl;
+import org.apache.activemq.artemis.utils.collections.LinkedListIterator;
+import org.apache.activemq.artemis.utils.collections.PriorityLinkedListImpl;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/group/impl/ClusteredResetMockTest.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/group/impl/ClusteredResetMockTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/group/impl/ClusteredResetMockTest.java
index 2f18c21..6a2dd15 100644
--- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/group/impl/ClusteredResetMockTest.java
+++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/group/impl/ClusteredResetMockTest.java
@@ -58,8 +58,8 @@ import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
 import org.apache.activemq.artemis.core.transaction.ResourceManager;
 import org.apache.activemq.artemis.spi.core.remoting.Acceptor;
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
-import org.apache.activemq.artemis.utils.ConcurrentHashSet;
 import org.apache.activemq.artemis.utils.ReusableLatch;
+import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/ScheduledDeliveryHandlerTest.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/ScheduledDeliveryHandlerTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/ScheduledDeliveryHandlerTest.java
index 5cea833..6b5eb9a 100644
--- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/ScheduledDeliveryHandlerTest.java
+++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/ScheduledDeliveryHandlerTest.java
@@ -47,10 +47,10 @@ import org.apache.activemq.artemis.core.server.Queue;
 import org.apache.activemq.artemis.core.server.RoutingContext;
 import org.apache.activemq.artemis.core.transaction.Transaction;
 import org.apache.activemq.artemis.utils.ActiveMQThreadFactory;
-import org.apache.activemq.artemis.utils.LinkedListIterator;
 import org.apache.activemq.artemis.utils.RandomUtil;
 import org.apache.activemq.artemis.utils.ReferenceCounter;
 import org.apache.activemq.artemis.utils.UUID;
+import org.apache.activemq.artemis.utils.collections.LinkedListIterator;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/etc/findbugs-exclude.xml
----------------------------------------------------------------------
diff --git a/etc/findbugs-exclude.xml b/etc/findbugs-exclude.xml
index 8ec9284..147a8e0 100644
--- a/etc/findbugs-exclude.xml
+++ b/etc/findbugs-exclude.xml
@@ -91,7 +91,7 @@ under the License.
 
          so methods are passed null arguments to trigger the exact same exceptions.
     -->
-    <Class name="org.apache.activemq.artemis.utils.TypedProperties"/>
+    <Class name="org.apache.activemq.artemis.utils.collections.TypedProperties"/>
     <Or>
       <Method name="getFloatProperty"/>
       <Method name="getDoubleProperty"/>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerTest.java
index 28200cf..3b2c272 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerTest.java
@@ -59,7 +59,7 @@ import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
 import org.apache.activemq.artemis.tests.util.Wait;
 import org.apache.activemq.artemis.utils.ByteUtil;
-import org.apache.activemq.artemis.utils.ConcurrentHashSet;
+import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
 import org.apache.qpid.jms.JmsConnectionFactory;
 import org.junit.Assert;
 import org.junit.Before;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SlowConsumerTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SlowConsumerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SlowConsumerTest.java
index c81c24c..7552caa 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SlowConsumerTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SlowConsumerTest.java
@@ -27,6 +27,7 @@ import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
 import org.apache.activemq.artemis.api.core.ActiveMQException;
 import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
 import org.apache.activemq.artemis.api.core.ActiveMQObjectClosedException;
+import org.apache.activemq.artemis.api.core.RoutingType;
 import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.api.core.client.ClientConsumer;
 import org.apache.activemq.artemis.api.core.client.ClientMessage;
@@ -39,14 +40,13 @@ import org.apache.activemq.artemis.api.core.management.CoreNotificationType;
 import org.apache.activemq.artemis.api.core.management.ManagementHelper;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.core.server.Queue;
-import org.apache.activemq.artemis.api.core.RoutingType;
 import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy;
 import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
 import org.apache.activemq.artemis.core.settings.impl.SlowConsumerPolicy;
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
-import org.apache.activemq.artemis.utils.ConcurrentHashSet;
 import org.apache.activemq.artemis.utils.RandomUtil;
 import org.apache.activemq.artemis.utils.TimeUtils;
+import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
 import org.jboss.logging.Logger;
 import org.junit.Assert;
 import org.junit.Before;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTest.java
index b0f03d4..2084796 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTest.java
@@ -38,7 +38,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
 import org.apache.activemq.artemis.api.core.ActiveMQException;
 import org.apache.activemq.artemis.api.core.Interceptor;
 import org.apache.activemq.artemis.api.core.Message;
-
+import org.apache.activemq.artemis.api.core.RoutingType;
 import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.api.core.TransportConfiguration;
 import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
@@ -68,7 +68,6 @@ import org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.core.server.MessageReference;
 import org.apache.activemq.artemis.core.server.Queue;
-import org.apache.activemq.artemis.api.core.RoutingType;
 import org.apache.activemq.artemis.core.server.cluster.Bridge;
 import org.apache.activemq.artemis.core.server.cluster.Transformer;
 import org.apache.activemq.artemis.core.server.cluster.impl.BridgeImpl;
@@ -78,9 +77,9 @@ import org.apache.activemq.artemis.core.transaction.impl.TransactionImpl;
 import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
 import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
-import org.apache.activemq.artemis.utils.LinkedListIterator;
 import org.apache.activemq.artemis.utils.RandomUtil;
 import org.apache.activemq.artemis.utils.ReusableLatch;
+import org.apache.activemq.artemis.utils.collections.LinkedListIterator;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTFQQNTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTFQQNTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTFQQNTest.java
index a1fa007..4f0b229 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTFQQNTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTFQQNTest.java
@@ -27,7 +27,7 @@ import org.apache.activemq.artemis.core.postoffice.Binding;
 import org.apache.activemq.artemis.core.protocol.mqtt.MQTTConnectionManager;
 import org.apache.activemq.artemis.core.protocol.mqtt.MQTTSession;
 import org.apache.activemq.artemis.core.server.QueueQueryResult;
-import org.apache.activemq.artemis.utils.ConcurrentHashSet;
+import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTest.java
index 28b7984..09477f3 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTest.java
@@ -45,7 +45,7 @@ import org.apache.activemq.artemis.core.protocol.mqtt.MQTTUtil;
 import org.apache.activemq.artemis.core.server.Queue;
 import org.apache.activemq.artemis.core.server.impl.AddressInfo;
 import org.apache.activemq.artemis.tests.util.Wait;
-import org.apache.activemq.artemis.utils.ConcurrentHashSet;
+import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
 import org.fusesource.mqtt.client.BlockingConnection;
 import org.fusesource.mqtt.client.MQTT;
 import org.fusesource.mqtt.client.MQTTException;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingSendTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingSendTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingSendTest.java
index 3675416..530877b 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingSendTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingSendTest.java
@@ -40,7 +40,7 @@ import org.apache.activemq.artemis.core.server.MessageReference;
 import org.apache.activemq.artemis.core.server.Queue;
 import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
-import org.apache.activemq.artemis.utils.LinkedListIterator;
+import org.apache.activemq.artemis.utils.collections.LinkedListIterator;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/MqttPluginTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/MqttPluginTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/MqttPluginTest.java
index 5e7f127..660df34 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/MqttPluginTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/MqttPluginTest.java
@@ -16,6 +16,22 @@
  */
 package org.apache.activemq.artemis.tests.integration.plugin;
 
+import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.activemq.artemis.core.protocol.mqtt.MQTTConnectionManager;
+import org.apache.activemq.artemis.core.protocol.mqtt.MQTTSession;
+import org.apache.activemq.artemis.tests.integration.mqtt.imported.MQTTClientProvider;
+import org.apache.activemq.artemis.tests.integration.mqtt.imported.MQTTTestSupport;
+import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
+import org.junit.Before;
+import org.junit.Test;
+
 import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_CLOSE_CONSUMER;
 import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_CLOSE_SESSION;
 import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_CREATE_CONNECTION;
@@ -39,22 +55,6 @@ import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledV
 import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.MESSAGE_ACKED;
 import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.MESSAGE_EXPIRED;
 
-import java.lang.reflect.Field;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.activemq.artemis.core.protocol.mqtt.MQTTConnectionManager;
-import org.apache.activemq.artemis.core.protocol.mqtt.MQTTSession;
-import org.apache.activemq.artemis.tests.integration.mqtt.imported.MQTTClientProvider;
-import org.apache.activemq.artemis.tests.integration.mqtt.imported.MQTTTestSupport;
-import org.apache.activemq.artemis.utils.ConcurrentHashSet;
-import org.junit.Before;
-import org.junit.Test;
-
 public class MqttPluginTest extends MQTTTestSupport {
 
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/PageCursorStressTest.java
----------------------------------------------------------------------
diff --git a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/PageCursorStressTest.java b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/PageCursorStressTest.java
index 61c8d30..b6afd2c 100644
--- a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/PageCursorStressTest.java
+++ b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/PageCursorStressTest.java
@@ -48,8 +48,8 @@ import org.apache.activemq.artemis.core.transaction.Transaction;
 import org.apache.activemq.artemis.core.transaction.impl.TransactionImpl;
 import org.apache.activemq.artemis.tests.unit.core.postoffice.impl.FakeQueue;
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
-import org.apache.activemq.artemis.utils.LinkedListIterator;
 import org.apache.activemq.artemis.utils.RandomUtil;
+import org.apache.activemq.artemis.utils.collections.LinkedListIterator;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/FakeQueue.java
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/FakeQueue.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/FakeQueue.java
index 66bdddb..efb9e77 100644
--- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/FakeQueue.java
+++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/FakeQueue.java
@@ -22,8 +22,8 @@ import java.util.Set;
 import java.util.concurrent.Executor;
 
 import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
-
 import org.apache.activemq.artemis.api.core.Message;
+import org.apache.activemq.artemis.api.core.RoutingType;
 import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.core.filter.Filter;
 import org.apache.activemq.artemis.core.paging.cursor.PageSubscription;
@@ -31,11 +31,10 @@ import org.apache.activemq.artemis.core.server.Consumer;
 import org.apache.activemq.artemis.core.server.MessageReference;
 import org.apache.activemq.artemis.core.server.Queue;
 import org.apache.activemq.artemis.core.server.RoutingContext;
-import org.apache.activemq.artemis.api.core.RoutingType;
 import org.apache.activemq.artemis.core.server.impl.AckReason;
 import org.apache.activemq.artemis.core.transaction.Transaction;
-import org.apache.activemq.artemis.utils.LinkedListIterator;
 import org.apache.activemq.artemis.utils.ReferenceCounter;
+import org.apache.activemq.artemis.utils.collections.LinkedListIterator;
 
 public class FakeQueue implements Queue {
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/QueueImplTest.java
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/QueueImplTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/QueueImplTest.java
index 0a08eb6..b64ff03 100644
--- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/QueueImplTest.java
+++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/QueueImplTest.java
@@ -49,7 +49,7 @@ import org.apache.activemq.artemis.tests.unit.core.server.impl.fakes.FakePostOff
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
 import org.apache.activemq.artemis.utils.ActiveMQThreadFactory;
 import org.apache.activemq.artemis.utils.FutureLatch;
-import org.apache.activemq.artemis.utils.LinkedListIterator;
+import org.apache.activemq.artemis.utils.collections.LinkedListIterator;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/LinkedListTest.java
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/LinkedListTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/LinkedListTest.java
index 1b7010e..e7c3eba 100644
--- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/LinkedListTest.java
+++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/LinkedListTest.java
@@ -23,8 +23,8 @@ import java.util.NoSuchElementException;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
-import org.apache.activemq.artemis.utils.LinkedListImpl;
-import org.apache.activemq.artemis.utils.LinkedListIterator;
+import org.apache.activemq.artemis.utils.collections.LinkedListImpl;
+import org.apache.activemq.artemis.utils.collections.LinkedListIterator;
 import org.junit.Before;
 import org.junit.Test;
 

Reply | Threaded
Open this post in threaded view
|

[3/6] activemq-artemis git commit: ARTEMIS-1156: moving our collections on its own package

clebertsuconic-2
In reply to this post by clebertsuconic-2
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/TypedProperties.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/TypedProperties.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/TypedProperties.java
new file mode 100644
index 0000000..9657f36
--- /dev/null
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/TypedProperties.java
@@ -0,0 +1,939 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.utils.collections;
+
+import java.nio.ByteBuffer;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import io.netty.buffer.ByteBuf;
+import org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException;
+import org.apache.activemq.artemis.api.core.SimpleString;
+import org.apache.activemq.artemis.logs.ActiveMQUtilBundle;
+import org.apache.activemq.artemis.utils.ByteUtil;
+import org.apache.activemq.artemis.utils.DataConstants;
+
+import static org.apache.activemq.artemis.utils.DataConstants.BOOLEAN;
+import static org.apache.activemq.artemis.utils.DataConstants.BYTE;
+import static org.apache.activemq.artemis.utils.DataConstants.BYTES;
+import static org.apache.activemq.artemis.utils.DataConstants.CHAR;
+import static org.apache.activemq.artemis.utils.DataConstants.DOUBLE;
+import static org.apache.activemq.artemis.utils.DataConstants.FLOAT;
+import static org.apache.activemq.artemis.utils.DataConstants.INT;
+import static org.apache.activemq.artemis.utils.DataConstants.LONG;
+import static org.apache.activemq.artemis.utils.DataConstants.NULL;
+import static org.apache.activemq.artemis.utils.DataConstants.SHORT;
+import static org.apache.activemq.artemis.utils.DataConstants.STRING;
+
+/**
+ * Property Value Conversion.
+ * <p>
+ * This implementation follows section 3.5.4 of the <i>Java Message Service</i> specification
+ * (Version 1.1 April 12, 2002).
+ * <p>
+ */
+public class TypedProperties {
+
+   private static final SimpleString AMQ_PROPNAME = new SimpleString("_AMQ_");
+
+   private Map<SimpleString, PropertyValue> properties;
+
+   private volatile int size;
+
+   private boolean internalProperties;
+
+   public TypedProperties() {
+   }
+
+   /**
+    *  Return the number of properites
+    * */
+   public int size() {
+      return properties.size();
+   }
+
+   public int getMemoryOffset() {
+      // The estimate is basically the encode size + 2 object references for each entry in the map
+      // Note we don't include the attributes or anything else since they already included in the memory estimate
+      // of the ServerMessage
+
+      return properties == null ? 0 : size + 2 * DataConstants.SIZE_INT * properties.size();
+   }
+
+   public TypedProperties(final TypedProperties other) {
+      properties = other.properties == null ? null : new HashMap<>(other.properties);
+      size = other.size;
+   }
+
+   public boolean hasInternalProperties() {
+      return internalProperties;
+   }
+
+   public void putBooleanProperty(final SimpleString key, final boolean value) {
+      checkCreateProperties();
+      doPutValue(key, new BooleanValue(value));
+   }
+
+   public void putByteProperty(final SimpleString key, final byte value) {
+      checkCreateProperties();
+      doPutValue(key, new ByteValue(value));
+   }
+
+   public void putBytesProperty(final SimpleString key, final byte[] value) {
+      checkCreateProperties();
+      doPutValue(key, value == null ? new NullValue() : new BytesValue(value));
+   }
+
+   public void putShortProperty(final SimpleString key, final short value) {
+      checkCreateProperties();
+      doPutValue(key, new ShortValue(value));
+   }
+
+   public void putIntProperty(final SimpleString key, final int value) {
+      checkCreateProperties();
+      doPutValue(key, new IntValue(value));
+   }
+
+   public void putLongProperty(final SimpleString key, final long value) {
+      checkCreateProperties();
+      doPutValue(key, new LongValue(value));
+   }
+
+   public void putFloatProperty(final SimpleString key, final float value) {
+      checkCreateProperties();
+      doPutValue(key, new FloatValue(value));
+   }
+
+   public void putDoubleProperty(final SimpleString key, final double value) {
+      checkCreateProperties();
+      doPutValue(key, new DoubleValue(value));
+   }
+
+   public void putSimpleStringProperty(final SimpleString key, final SimpleString value) {
+      checkCreateProperties();
+      doPutValue(key, value == null ? new NullValue() : new StringValue(value));
+   }
+
+   public void putNullValue(final SimpleString key) {
+      checkCreateProperties();
+      doPutValue(key, new NullValue());
+   }
+
+   public void putCharProperty(final SimpleString key, final char value) {
+      checkCreateProperties();
+      doPutValue(key, new CharValue(value));
+   }
+
+   public void putTypedProperties(final TypedProperties otherProps) {
+      if (otherProps == null || otherProps.properties == null) {
+         return;
+      }
+
+      checkCreateProperties();
+      Set<Entry<SimpleString, PropertyValue>> otherEntries = otherProps.properties.entrySet();
+      for (Entry<SimpleString, PropertyValue> otherEntry : otherEntries) {
+         doPutValue(otherEntry.getKey(), otherEntry.getValue());
+      }
+   }
+
+   public Object getProperty(final SimpleString key) {
+      return doGetProperty(key);
+   }
+
+   public Boolean getBooleanProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
+      Object value = doGetProperty(key);
+      if (value == null) {
+         return Boolean.valueOf(null);
+      } else if (value instanceof Boolean) {
+         return (Boolean) value;
+      } else if (value instanceof SimpleString) {
+         return Boolean.valueOf(((SimpleString) value).toString());
+      }
+      throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
+   }
+
+   public Byte getByteProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
+      Object value = doGetProperty(key);
+      if (value == null) {
+         return Byte.valueOf(null);
+      } else if (value instanceof Byte) {
+         return (Byte) value;
+      } else if (value instanceof SimpleString) {
+         return Byte.parseByte(((SimpleString) value).toString());
+      }
+      throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
+   }
+
+   public Character getCharProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
+      Object value = doGetProperty(key);
+      if (value == null) {
+         throw new NullPointerException("Invalid conversion: " + key);
+      }
+
+      if (value instanceof Character) {
+         return ((Character) value);
+      }
+      throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
+   }
+
+   public byte[] getBytesProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
+      Object value = doGetProperty(key);
+      if (value == null) {
+         return null;
+      } else if (value instanceof byte[]) {
+         return (byte[]) value;
+      }
+      throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
+   }
+
+   public Double getDoubleProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
+      Object value = doGetProperty(key);
+      if (value == null) {
+         return Double.valueOf(null);
+      } else if (value instanceof Float) {
+         return ((Float) value).doubleValue();
+      } else if (value instanceof Double) {
+         return (Double) value;
+      } else if (value instanceof SimpleString) {
+         return Double.parseDouble(((SimpleString) value).toString());
+      }
+      throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
+   }
+
+   public Integer getIntProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
+      Object value = doGetProperty(key);
+      if (value == null) {
+         return Integer.valueOf(null);
+      } else if (value instanceof Integer) {
+         return (Integer) value;
+      } else if (value instanceof Byte) {
+         return ((Byte) value).intValue();
+      } else if (value instanceof Short) {
+         return ((Short) value).intValue();
+      } else if (value instanceof SimpleString) {
+         return Integer.parseInt(((SimpleString) value).toString());
+      }
+      throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
+   }
+
+   public Long getLongProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
+      Object value = doGetProperty(key);
+      if (value == null) {
+         return Long.valueOf(null);
+      } else if (value instanceof Long) {
+         return (Long) value;
+      } else if (value instanceof Byte) {
+         return ((Byte) value).longValue();
+      } else if (value instanceof Short) {
+         return ((Short) value).longValue();
+      } else if (value instanceof Integer) {
+         return ((Integer) value).longValue();
+      } else if (value instanceof SimpleString) {
+         return Long.parseLong(((SimpleString) value).toString());
+      }
+      throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
+   }
+
+   public Short getShortProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
+      Object value = doGetProperty(key);
+      if (value == null) {
+         return Short.valueOf(null);
+      } else if (value instanceof Byte) {
+         return ((Byte) value).shortValue();
+      } else if (value instanceof Short) {
+         return (Short) value;
+      } else if (value instanceof SimpleString) {
+         return Short.parseShort(((SimpleString) value).toString());
+      }
+      throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
+   }
+
+   public Float getFloatProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
+      Object value = doGetProperty(key);
+      if (value == null)
+         return Float.valueOf(null);
+      if (value instanceof Float) {
+         return ((Float) value);
+      }
+      if (value instanceof SimpleString) {
+         return Float.parseFloat(((SimpleString) value).toString());
+      }
+      throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
+   }
+
+   public SimpleString getSimpleStringProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
+      Object value = doGetProperty(key);
+
+      if (value == null) {
+         return null;
+      }
+
+      if (value instanceof SimpleString) {
+         return (SimpleString) value;
+      } else if (value instanceof Boolean) {
+         return new SimpleString(value.toString());
+      } else if (value instanceof Character) {
+         return new SimpleString(value.toString());
+      } else if (value instanceof Byte) {
+         return new SimpleString(value.toString());
+      } else if (value instanceof Short) {
+         return new SimpleString(value.toString());
+      } else if (value instanceof Integer) {
+         return new SimpleString(value.toString());
+      } else if (value instanceof Long) {
+         return new SimpleString(value.toString());
+      } else if (value instanceof Float) {
+         return new SimpleString(value.toString());
+      } else if (value instanceof Double) {
+         return new SimpleString(value.toString());
+      }
+      throw new ActiveMQPropertyConversionException("Invalid conversion: " + key);
+   }
+
+   public Object removeProperty(final SimpleString key) {
+      return doRemoveProperty(key);
+   }
+
+   public boolean containsProperty(final SimpleString key) {
+      if (size == 0) {
+         return false;
+
+      } else {
+         return properties.containsKey(key);
+      }
+   }
+
+   public Set<SimpleString> getPropertyNames() {
+      if (size == 0) {
+         return Collections.emptySet();
+      } else {
+         return properties.keySet();
+      }
+   }
+
+   public synchronized void decode(final ByteBuf buffer) {
+      byte b = buffer.readByte();
+
+      if (b == DataConstants.NULL) {
+         properties = null;
+      } else {
+         int numHeaders = buffer.readInt();
+
+         properties = new HashMap<>(numHeaders);
+         size = 0;
+
+         for (int i = 0; i < numHeaders; i++) {
+            int len = buffer.readInt();
+            byte[] data = new byte[len];
+            buffer.readBytes(data);
+            SimpleString key = new SimpleString(data);
+
+            byte type = buffer.readByte();
+
+            PropertyValue val;
+
+            switch (type) {
+               case NULL: {
+                  val = new NullValue();
+                  doPutValue(key, val);
+                  break;
+               }
+               case CHAR: {
+                  val = new CharValue(buffer);
+                  doPutValue(key, val);
+                  break;
+               }
+               case BOOLEAN: {
+                  val = new BooleanValue(buffer);
+                  doPutValue(key, val);
+                  break;
+               }
+               case BYTE: {
+                  val = new ByteValue(buffer);
+                  doPutValue(key, val);
+                  break;
+               }
+               case BYTES: {
+                  val = new BytesValue(buffer);
+                  doPutValue(key, val);
+                  break;
+               }
+               case SHORT: {
+                  val = new ShortValue(buffer);
+                  doPutValue(key, val);
+                  break;
+               }
+               case INT: {
+                  val = new IntValue(buffer);
+                  doPutValue(key, val);
+                  break;
+               }
+               case LONG: {
+                  val = new LongValue(buffer);
+                  doPutValue(key, val);
+                  break;
+               }
+               case FLOAT: {
+                  val = new FloatValue(buffer);
+                  doPutValue(key, val);
+                  break;
+               }
+               case DOUBLE: {
+                  val = new DoubleValue(buffer);
+                  doPutValue(key, val);
+                  break;
+               }
+               case STRING: {
+                  val = new StringValue(buffer);
+                  doPutValue(key, val);
+                  break;
+               }
+               default: {
+                  throw ActiveMQUtilBundle.BUNDLE.invalidType(type);
+               }
+            }
+         }
+      }
+   }
+
+   public synchronized void encode(final ByteBuf buffer) {
+      if (properties == null) {
+         buffer.writeByte(DataConstants.NULL);
+      } else {
+         buffer.writeByte(DataConstants.NOT_NULL);
+
+         buffer.writeInt(properties.size());
+
+         for (Map.Entry<SimpleString, PropertyValue> entry : properties.entrySet()) {
+            SimpleString s = entry.getKey();
+            byte[] data = s.getData();
+            buffer.writeInt(data.length);
+            buffer.writeBytes(data);
+
+            entry.getValue().write(buffer);
+         }
+      }
+   }
+
+   public int getEncodeSize() {
+      if (properties == null) {
+         return DataConstants.SIZE_BYTE;
+      } else {
+         return DataConstants.SIZE_BYTE + DataConstants.SIZE_INT + size;
+      }
+   }
+
+   public void clear() {
+      if (properties != null) {
+         properties.clear();
+      }
+   }
+
+   @Override
+   public String toString() {
+      StringBuilder sb = new StringBuilder("TypedProperties[");
+
+      if (properties != null) {
+
+         Iterator<Entry<SimpleString, PropertyValue>> iter = properties.entrySet().iterator();
+
+         while (iter.hasNext()) {
+            Entry<SimpleString, PropertyValue> iterItem = iter.next();
+            sb.append(iterItem.getKey() + "=");
+
+            // it seems weird but it's right!!
+            // The first getValue is from the EntrySet
+            // The second is to convert the PropertyValue into the actual value
+            Object theValue = iterItem.getValue().getValue();
+
+            if (theValue == null) {
+               sb.append("NULL-value");
+            } else if (theValue instanceof byte[]) {
+               sb.append("[" + ByteUtil.maxString(ByteUtil.bytesToHex((byte[]) theValue, 2), 150) + ")");
+
+               if (iterItem.getKey().toString().startsWith("_AMQ_ROUTE_TO")) {
+                  sb.append(",bytesAsLongs(");
+                  try {
+                     ByteBuffer buff = ByteBuffer.wrap((byte[]) theValue);
+                     while (buff.hasRemaining()) {
+                        long bindingID = buff.getLong();
+                        sb.append(bindingID);
+                        if (buff.hasRemaining()) {
+                           sb.append(",");
+                        }
+                     }
+                  } catch (Throwable e) {
+                     sb.append("error-converting-longs=" + e.getMessage());
+                  }
+                  sb.append("]");
+               }
+            } else {
+               sb.append(theValue.toString());
+            }
+
+            if (iter.hasNext()) {
+               sb.append(",");
+            }
+         }
+      }
+
+      return sb.append("]").toString();
+   }
+
+   // Private ------------------------------------------------------------------------------------
+
+   private void checkCreateProperties() {
+      if (properties == null) {
+         properties = new HashMap<>();
+      }
+   }
+
+   private synchronized void doPutValue(final SimpleString key, final PropertyValue value) {
+      if (key.startsWith(AMQ_PROPNAME)) {
+         internalProperties = true;
+      }
+
+      PropertyValue oldValue = properties.put(key, value);
+      if (oldValue != null) {
+         size += value.encodeSize() - oldValue.encodeSize();
+      } else {
+         size += SimpleString.sizeofString(key) + value.encodeSize();
+      }
+   }
+
+   private synchronized Object doRemoveProperty(final SimpleString key) {
+      if (properties == null) {
+         return null;
+      }
+
+      PropertyValue val = properties.remove(key);
+
+      if (val == null) {
+         return null;
+      } else {
+         size -= SimpleString.sizeofString(key) + val.encodeSize();
+
+         return val.getValue();
+      }
+   }
+
+   private synchronized Object doGetProperty(final Object key) {
+      if (size == 0) {
+         return null;
+      }
+
+      PropertyValue val = properties.get(key);
+
+      if (val == null) {
+         return null;
+      } else {
+         return val.getValue();
+      }
+   }
+
+   // Inner classes ------------------------------------------------------------------------------
+
+   private abstract static class PropertyValue {
+
+      abstract Object getValue();
+
+      abstract void write(ByteBuf buffer);
+
+      abstract int encodeSize();
+
+      @Override
+      public String toString() {
+         return "" + getValue();
+      }
+   }
+
+   private static final class NullValue extends PropertyValue {
+
+      private NullValue() {
+      }
+
+      @Override
+      public Object getValue() {
+         return null;
+      }
+
+      @Override
+      public void write(final ByteBuf buffer) {
+         buffer.writeByte(DataConstants.NULL);
+      }
+
+      @Override
+      public int encodeSize() {
+         return DataConstants.SIZE_BYTE;
+      }
+
+   }
+
+   private static final class BooleanValue extends PropertyValue {
+
+      final boolean val;
+
+      private BooleanValue(final boolean val) {
+         this.val = val;
+      }
+
+      private BooleanValue(final ByteBuf buffer) {
+         val = buffer.readBoolean();
+      }
+
+      @Override
+      public Object getValue() {
+         return val;
+      }
+
+      @Override
+      public void write(final ByteBuf buffer) {
+         buffer.writeByte(DataConstants.BOOLEAN);
+         buffer.writeBoolean(val);
+      }
+
+      @Override
+      public int encodeSize() {
+         return DataConstants.SIZE_BYTE + DataConstants.SIZE_BOOLEAN;
+      }
+
+   }
+
+   private static final class ByteValue extends PropertyValue {
+
+      final byte val;
+
+      private ByteValue(final byte val) {
+         this.val = val;
+      }
+
+      private ByteValue(final ByteBuf buffer) {
+         val = buffer.readByte();
+      }
+
+      @Override
+      public Object getValue() {
+         return val;
+      }
+
+      @Override
+      public void write(final ByteBuf buffer) {
+         buffer.writeByte(DataConstants.BYTE);
+         buffer.writeByte(val);
+      }
+
+      @Override
+      public int encodeSize() {
+         return DataConstants.SIZE_BYTE + DataConstants.SIZE_BYTE;
+      }
+   }
+
+   private static final class BytesValue extends PropertyValue {
+
+      final byte[] val;
+
+      private BytesValue(final byte[] val) {
+         this.val = val;
+      }
+
+      private BytesValue(final ByteBuf buffer) {
+         int len = buffer.readInt();
+         val = new byte[len];
+         buffer.readBytes(val);
+      }
+
+      @Override
+      public Object getValue() {
+         return val;
+      }
+
+      @Override
+      public void write(final ByteBuf buffer) {
+         buffer.writeByte(DataConstants.BYTES);
+         buffer.writeInt(val.length);
+         buffer.writeBytes(val);
+      }
+
+      @Override
+      public int encodeSize() {
+         return DataConstants.SIZE_BYTE + DataConstants.SIZE_INT + val.length;
+      }
+
+   }
+
+   private static final class ShortValue extends PropertyValue {
+
+      final short val;
+
+      private ShortValue(final short val) {
+         this.val = val;
+      }
+
+      private ShortValue(final ByteBuf buffer) {
+         val = buffer.readShort();
+      }
+
+      @Override
+      public Object getValue() {
+         return val;
+      }
+
+      @Override
+      public void write(final ByteBuf buffer) {
+         buffer.writeByte(DataConstants.SHORT);
+         buffer.writeShort(val);
+      }
+
+      @Override
+      public int encodeSize() {
+         return DataConstants.SIZE_BYTE + DataConstants.SIZE_SHORT;
+      }
+   }
+
+   private static final class IntValue extends PropertyValue {
+
+      final int val;
+
+      private IntValue(final int val) {
+         this.val = val;
+      }
+
+      private IntValue(final ByteBuf buffer) {
+         val = buffer.readInt();
+      }
+
+      @Override
+      public Object getValue() {
+         return val;
+      }
+
+      @Override
+      public void write(final ByteBuf buffer) {
+         buffer.writeByte(DataConstants.INT);
+         buffer.writeInt(val);
+      }
+
+      @Override
+      public int encodeSize() {
+         return DataConstants.SIZE_BYTE + DataConstants.SIZE_INT;
+      }
+   }
+
+   private static final class LongValue extends PropertyValue {
+
+      final long val;
+
+      private LongValue(final long val) {
+         this.val = val;
+      }
+
+      private LongValue(final ByteBuf buffer) {
+         val = buffer.readLong();
+      }
+
+      @Override
+      public Object getValue() {
+         return val;
+      }
+
+      @Override
+      public void write(final ByteBuf buffer) {
+         buffer.writeByte(DataConstants.LONG);
+         buffer.writeLong(val);
+      }
+
+      @Override
+      public int encodeSize() {
+         return DataConstants.SIZE_BYTE + DataConstants.SIZE_LONG;
+      }
+   }
+
+   private static final class FloatValue extends PropertyValue {
+
+      final float val;
+
+      private FloatValue(final float val) {
+         this.val = val;
+      }
+
+      private FloatValue(final ByteBuf buffer) {
+         val = Float.intBitsToFloat(buffer.readInt());
+      }
+
+      @Override
+      public Object getValue() {
+         return val;
+      }
+
+      @Override
+      public void write(final ByteBuf buffer) {
+         buffer.writeByte(DataConstants.FLOAT);
+         buffer.writeInt(Float.floatToIntBits(val));
+      }
+
+      @Override
+      public int encodeSize() {
+         return DataConstants.SIZE_BYTE + DataConstants.SIZE_FLOAT;
+      }
+
+   }
+
+   private static final class DoubleValue extends PropertyValue {
+
+      final double val;
+
+      private DoubleValue(final double val) {
+         this.val = val;
+      }
+
+      private DoubleValue(final ByteBuf buffer) {
+         val = Double.longBitsToDouble(buffer.readLong());
+      }
+
+      @Override
+      public Object getValue() {
+         return val;
+      }
+
+      @Override
+      public void write(final ByteBuf buffer) {
+         buffer.writeByte(DataConstants.DOUBLE);
+         buffer.writeLong(Double.doubleToLongBits(val));
+      }
+
+      @Override
+      public int encodeSize() {
+         return DataConstants.SIZE_BYTE + DataConstants.SIZE_DOUBLE;
+      }
+   }
+
+   private static final class CharValue extends PropertyValue {
+
+      final char val;
+
+      private CharValue(final char val) {
+         this.val = val;
+      }
+
+      private CharValue(final ByteBuf buffer) {
+         val = (char) buffer.readShort();
+      }
+
+      @Override
+      public Object getValue() {
+         return val;
+      }
+
+      @Override
+      public void write(final ByteBuf buffer) {
+         buffer.writeByte(DataConstants.CHAR);
+         buffer.writeShort((short) val);
+      }
+
+      @Override
+      public int encodeSize() {
+         return DataConstants.SIZE_BYTE + DataConstants.SIZE_CHAR;
+      }
+   }
+
+   private static final class StringValue extends PropertyValue {
+
+      final SimpleString val;
+
+      private StringValue(final SimpleString val) {
+         this.val = val;
+      }
+
+      private StringValue(final ByteBuf buffer) {
+         val = SimpleString.readSimpleString(buffer);
+      }
+
+      @Override
+      public Object getValue() {
+         return val;
+      }
+
+      @Override
+      public void write(final ByteBuf buffer) {
+         buffer.writeByte(DataConstants.STRING);
+         SimpleString.writeSimpleString(buffer, val);
+      }
+
+      @Override
+      public int encodeSize() {
+         return DataConstants.SIZE_BYTE + SimpleString.sizeofString(val);
+      }
+   }
+
+   public boolean isEmpty() {
+      return properties.isEmpty();
+   }
+
+   public Map<String, Object> getMap() {
+      Map<String, Object> m = new HashMap<>();
+      for (Entry<SimpleString, PropertyValue> entry : properties.entrySet()) {
+         Object val = entry.getValue().getValue();
+         if (val instanceof SimpleString) {
+            m.put(entry.getKey().toString(), ((SimpleString) val).toString());
+         } else {
+            m.put(entry.getKey().toString(), val);
+         }
+      }
+      return m;
+   }
+
+   /**
+    * Helper for MapMessage#setObjectProperty(String, Object)
+    *
+    * @param key        The SimpleString key
+    * @param value      The Object value
+    * @param properties The typed properties
+    */
+   public static void setObjectProperty(final SimpleString key, final Object value, final TypedProperties properties) {
+      if (value == null) {
+         properties.putNullValue(key);
+      } else if (value instanceof Boolean) {
+         properties.putBooleanProperty(key, (Boolean) value);
+      } else if (value instanceof Byte) {
+         properties.putByteProperty(key, (Byte) value);
+      } else if (value instanceof Character) {
+         properties.putCharProperty(key, (Character) value);
+      } else if (value instanceof Short) {
+         properties.putShortProperty(key, (Short) value);
+      } else if (value instanceof Integer) {
+         properties.putIntProperty(key, (Integer) value);
+      } else if (value instanceof Long) {
+         properties.putLongProperty(key, (Long) value);
+      } else if (value instanceof Float) {
+         properties.putFloatProperty(key, (Float) value);
+      } else if (value instanceof Double) {
+         properties.putDoubleProperty(key, (Double) value);
+      } else if (value instanceof String) {
+         properties.putSimpleStringProperty(key, new SimpleString((String) value));
+      } else if (value instanceof SimpleString) {
+         properties.putSimpleStringProperty(key, (SimpleString) value);
+      } else if (value instanceof byte[]) {
+         properties.putBytesProperty(key, (byte[]) value);
+      } else {
+         throw new ActiveMQPropertyConversionException(value.getClass() + " is not a valid property type");
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/uri/FluentPropertyBeanIntrospectorWithIgnores.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/uri/FluentPropertyBeanIntrospectorWithIgnores.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/uri/FluentPropertyBeanIntrospectorWithIgnores.java
index 7df9131..ad56353 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/uri/FluentPropertyBeanIntrospectorWithIgnores.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/uri/FluentPropertyBeanIntrospectorWithIgnores.java
@@ -23,7 +23,7 @@ import java.lang.reflect.Method;
 import java.util.Locale;
 
 import org.apache.activemq.artemis.api.core.Pair;
-import org.apache.activemq.artemis.utils.ConcurrentHashSet;
+import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
 import org.apache.commons.beanutils.FluentPropertyBeanIntrospector;
 import org.apache.commons.beanutils.IntrospectionContext;
 import org.jboss.logging.Logger;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/ConcurrentHashSetTest.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/ConcurrentHashSetTest.java b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/ConcurrentHashSetTest.java
index 4055801..8e0c8c8 100644
--- a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/ConcurrentHashSetTest.java
+++ b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/ConcurrentHashSetTest.java
@@ -18,6 +18,8 @@ package org.apache.activemq.artemis.utils;
 
 import java.util.Iterator;
 
+import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
+import org.apache.activemq.artemis.utils.collections.ConcurrentSet;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesConversionTest.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesConversionTest.java b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesConversionTest.java
index cec3959..5391724 100644
--- a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesConversionTest.java
+++ b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesConversionTest.java
@@ -18,6 +18,7 @@ package org.apache.activemq.artemis.utils;
 
 import org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException;
 import org.apache.activemq.artemis.api.core.SimpleString;
+import org.apache.activemq.artemis.utils.collections.TypedProperties;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesTest.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesTest.java b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesTest.java
index cb6c8fe..38144c9 100644
--- a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesTest.java
+++ b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesTest.java
@@ -21,6 +21,7 @@ import java.util.Iterator;
 import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
 import org.apache.activemq.artemis.api.core.ActiveMQBuffers;
 import org.apache.activemq.artemis.api.core.SimpleString;
+import org.apache.activemq.artemis.utils.collections.TypedProperties;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientConsumerImpl.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientConsumerImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientConsumerImpl.java
index 82af968..0ff971d 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientConsumerImpl.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientConsumerImpl.java
@@ -40,10 +40,10 @@ import org.apache.activemq.artemis.spi.core.remoting.ConsumerContext;
 import org.apache.activemq.artemis.spi.core.remoting.SessionContext;
 import org.apache.activemq.artemis.utils.ByteUtil;
 import org.apache.activemq.artemis.utils.FutureLatch;
-import org.apache.activemq.artemis.utils.PriorityLinkedList;
-import org.apache.activemq.artemis.utils.PriorityLinkedListImpl;
 import org.apache.activemq.artemis.utils.ReusableLatch;
 import org.apache.activemq.artemis.utils.TokenBucketLimiter;
+import org.apache.activemq.artemis.utils.collections.PriorityLinkedList;
+import org.apache.activemq.artemis.utils.collections.PriorityLinkedListImpl;
 import org.jboss.logging.Logger;
 
 public final class ClientConsumerImpl implements ClientConsumerInternal {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientMessageImpl.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientMessageImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientMessageImpl.java
index 252ae86..91fb6ca 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientMessageImpl.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientMessageImpl.java
@@ -31,8 +31,8 @@ import org.apache.activemq.artemis.core.client.ActiveMQClientMessageBundle;
 import org.apache.activemq.artemis.core.message.LargeBodyEncoder;
 import org.apache.activemq.artemis.core.message.impl.CoreMessage;
 import org.apache.activemq.artemis.reader.MessageUtil;
-import org.apache.activemq.artemis.utils.TypedProperties;
 import org.apache.activemq.artemis.utils.UUID;
+import org.apache.activemq.artemis.utils.collections.TypedProperties;
 
 /**
  * A ClientMessageImpl

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientMessageInternal.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientMessageInternal.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientMessageInternal.java
index 4b87878..1a7fe07 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientMessageInternal.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientMessageInternal.java
@@ -17,7 +17,7 @@
 package org.apache.activemq.artemis.core.client.impl;
 
 import org.apache.activemq.artemis.api.core.client.ClientMessage;
-import org.apache.activemq.artemis.utils.TypedProperties;
+import org.apache.activemq.artemis.utils.collections.TypedProperties;
 
 public interface ClientMessageInternal extends ClientMessage {
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java
index addbbbd..8f6a5ea 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java
@@ -62,11 +62,11 @@ import org.apache.activemq.artemis.spi.core.remoting.ConnectorFactory;
 import org.apache.activemq.artemis.spi.core.remoting.SessionContext;
 import org.apache.activemq.artemis.spi.core.remoting.TopologyResponseHandler;
 import org.apache.activemq.artemis.utils.ClassloadingUtil;
-import org.apache.activemq.artemis.utils.ConcurrentHashSet;
 import org.apache.activemq.artemis.utils.ConfirmationWindowWarning;
 import org.apache.activemq.artemis.utils.ExecutorFactory;
 import org.apache.activemq.artemis.utils.OrderedExecutorFactory;
 import org.apache.activemq.artemis.utils.UUIDGenerator;
+import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
 import org.jboss.logging.Logger;
 
 public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, ClientConnectionLifeCycleListener {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/cluster/DiscoveryGroup.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/cluster/DiscoveryGroup.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/cluster/DiscoveryGroup.java
index 7c40602..282932d 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/cluster/DiscoveryGroup.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/cluster/DiscoveryGroup.java
@@ -35,7 +35,7 @@ import org.apache.activemq.artemis.core.client.ActiveMQClientLogger;
 import org.apache.activemq.artemis.core.server.ActiveMQComponent;
 import org.apache.activemq.artemis.core.server.management.Notification;
 import org.apache.activemq.artemis.core.server.management.NotificationService;
-import org.apache.activemq.artemis.utils.TypedProperties;
+import org.apache.activemq.artemis.utils.collections.TypedProperties;
 import org.jboss.logging.Logger;
 
 /**

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
index 215c268..369de7d 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
@@ -39,8 +39,8 @@ import org.apache.activemq.artemis.core.persistence.Persister;
 import org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl;
 import org.apache.activemq.artemis.reader.MessageUtil;
 import org.apache.activemq.artemis.utils.DataConstants;
-import org.apache.activemq.artemis.utils.TypedProperties;
 import org.apache.activemq.artemis.utils.UUID;
+import org.apache.activemq.artemis.utils.collections.TypedProperties;
 import org.jboss.logging.Logger;
 
 /** Note: you shouldn't change properties using multi-threads. Change your properties before you can send it to multiple

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/server/management/Notification.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/server/management/Notification.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/server/management/Notification.java
index ae1f91d..1bdc52a 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/server/management/Notification.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/server/management/Notification.java
@@ -17,7 +17,7 @@
 package org.apache.activemq.artemis.core.server.management;
 
 import org.apache.activemq.artemis.api.core.management.NotificationType;
-import org.apache.activemq.artemis.utils.TypedProperties;
+import org.apache.activemq.artemis.utils.collections.TypedProperties;
 
 /**
  * A Notification

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/MapMessageUtil.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/MapMessageUtil.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/MapMessageUtil.java
index 8560f5d..52f8be5 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/MapMessageUtil.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/MapMessageUtil.java
@@ -17,7 +17,7 @@
 package org.apache.activemq.artemis.reader;
 
 import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
-import org.apache.activemq.artemis.utils.TypedProperties;
+import org.apache.activemq.artemis.utils.collections.TypedProperties;
 
 public class MapMessageUtil extends MessageUtil {
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/LinkedList.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/LinkedList.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/LinkedList.java
deleted file mode 100644
index fd64aaf..0000000
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/LinkedList.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.artemis.utils;
-
-public interface LinkedList<E> {
-
-   void addHead(E e);
-
-   void addTail(E e);
-
-   E poll();
-
-   LinkedListIterator<E> iterator();
-
-   void clear();
-
-   int size();
-}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/LinkedListImpl.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/LinkedListImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/LinkedListImpl.java
deleted file mode 100644
index f0d2945..0000000
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/LinkedListImpl.java
+++ /dev/null
@@ -1,390 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.artemis.utils;
-
-import java.lang.reflect.Array;
-import java.util.NoSuchElementException;
-
-/**
- * A linked list implementation which allows multiple iterators to exist at the same time on the queue, and which see any
- * elements added or removed from the queue either directly or via iterators.
- *
- * This class is not thread safe.
- */
-public class LinkedListImpl<E> implements LinkedList<E> {
-
-   private static final int INITIAL_ITERATOR_ARRAY_SIZE = 10;
-
-   private final Node<E> head = new Node<>(null);
-
-   private Node<E> tail = null;
-
-   private int size;
-
-   // We store in an array rather than a Map for the best performance
-   private volatile Iterator[] iters;
-
-   private int numIters;
-
-   private int nextIndex;
-
-   public LinkedListImpl() {
-      iters = createIteratorArray(INITIAL_ITERATOR_ARRAY_SIZE);
-   }
-
-   @Override
-   public void addHead(E e) {
-      Node<E> node = new Node<>(e);
-
-      node.next = head.next;
-
-      node.prev = head;
-
-      head.next = node;
-
-      if (size == 0) {
-         tail = node;
-      } else {
-         // Need to set the previous element on the former head
-         node.next.prev = node;
-      }
-
-      size++;
-   }
-
-   @Override
-   public void addTail(E e) {
-      if (size == 0) {
-         addHead(e);
-      } else {
-         Node<E> node = new Node<>(e);
-
-         node.prev = tail;
-
-         tail.next = node;
-
-         tail = node;
-
-         size++;
-      }
-   }
-
-   @Override
-   public E poll() {
-      Node<E> ret = head.next;
-
-      if (ret != null) {
-         removeAfter(head);
-
-         return ret.val;
-      } else {
-         return null;
-      }
-   }
-
-   @Override
-   public void clear() {
-      tail = head.next = null;
-
-      size = 0;
-   }
-
-   @Override
-   public int size() {
-      return size;
-   }
-
-   @Override
-   public LinkedListIterator<E> iterator() {
-      return new Iterator();
-   }
-
-   @Override
-   public String toString() {
-      StringBuilder str = new StringBuilder("LinkedListImpl [ ");
-
-      Node<E> node = head;
-
-      while (node != null) {
-         str.append(node.toString());
-
-         if (node.next != null) {
-            str.append(", ");
-         }
-
-         node = node.next;
-      }
-
-      return str.toString();
-   }
-
-   public int numIters() {
-      return numIters;
-   }
-
-   private Iterator[] createIteratorArray(int size) {
-      return (Iterator[]) Array.newInstance(Iterator.class, size);
-   }
-
-   private void removeAfter(Node<E> node) {
-      Node<E> toRemove = node.next;
-
-      node.next = toRemove.next;
-
-      if (toRemove.next != null) {
-         toRemove.next.prev = node;
-      }
-
-      if (toRemove == tail) {
-         tail = node;
-      }
-
-      size--;
-
-      if (toRemove.iterCount != 0) {
-         LinkedListImpl.this.nudgeIterators(toRemove);
-      }
-
-      //Help GC - otherwise GC potentially has to traverse a very long list to see if elements are reachable, this can result in OOM
-      //https://jira.jboss.org/browse/HORNETQ-469
-      toRemove.next = toRemove.prev = null;
-   }
-
-   private synchronized void nudgeIterators(Node<E> node) {
-      for (int i = 0; i < numIters; i++) {
-         Iterator iter = iters[i];
-         if (iter != null) {
-            iter.nudged(node);
-         }
-      }
-   }
-
-   private synchronized void addIter(Iterator iter) {
-      if (numIters == iters.length) {
-         resize(2 * numIters);
-      }
-
-      iters[nextIndex++] = iter;
-
-      numIters++;
-   }
-
-   private synchronized void resize(int newSize) {
-      Iterator[] newIters = createIteratorArray(newSize);
-
-      System.arraycopy(iters, 0, newIters, 0, numIters);
-
-      iters = newIters;
-   }
-
-   private synchronized void removeIter(Iterator iter) {
-      for (int i = 0; i < numIters; i++) {
-         if (iter == iters[i]) {
-            iters[i] = null;
-
-            if (i != numIters - 1) {
-               // Fill in the hole
-
-               System.arraycopy(iters, i + 1, iters, i, numIters - i - 1);
-            }
-
-            numIters--;
-
-            if (numIters >= INITIAL_ITERATOR_ARRAY_SIZE && numIters == iters.length / 2) {
-               resize(numIters);
-            }
-
-            nextIndex--;
-
-            return;
-         }
-      }
-
-      throw new IllegalStateException("Cannot find iter to remove");
-   }
-
-   private static final class Node<E> {
-
-      Node<E> next;
-
-      Node<E> prev;
-
-      final E val;
-
-      int iterCount;
-
-      Node(E e) {
-         val = e;
-      }
-
-      @Override
-      public String toString() {
-         return "Node, value = " + val;
-      }
-   }
-
-   private class Iterator implements LinkedListIterator<E> {
-
-      Node<E> last;
-
-      Node<E> current = head.next;
-
-      boolean repeat;
-
-      Iterator() {
-         if (current != null) {
-            current.iterCount++;
-         }
-
-         addIter(this);
-      }
-
-      @Override
-      public void repeat() {
-         repeat = true;
-      }
-
-      @Override
-      public boolean hasNext() {
-         Node<E> e = getNode();
-
-         if (e != null && (e != last || repeat)) {
-            return true;
-         }
-
-         return canAdvance();
-      }
-
-      @Override
-      public E next() {
-         Node<E> e = getNode();
-
-         if (repeat) {
-            repeat = false;
-
-            if (e != null) {
-               return e.val;
-            } else {
-               if (canAdvance()) {
-                  advance();
-
-                  e = getNode();
-
-                  return e.val;
-               } else {
-                  throw new NoSuchElementException();
-               }
-            }
-         }
-
-         if (e == null || e == last) {
-            if (canAdvance()) {
-               advance();
-
-               e = getNode();
-            } else {
-               throw new NoSuchElementException();
-            }
-         }
-
-         last = e;
-
-         repeat = false;
-
-         return e.val;
-      }
-
-      @Override
-      public void remove() {
-         if (last == null) {
-            throw new NoSuchElementException();
-         }
-
-         if (current == null) {
-            throw new NoSuchElementException();
-         }
-
-         LinkedListImpl.this.removeAfter(current.prev);
-
-         last = null;
-      }
-
-      @Override
-      public void close() {
-         removeIter(this);
-      }
-
-      public void nudged(Node<E> node) {
-         if (current == node) {
-            if (canAdvance()) {
-               advance();
-            } else {
-               if (current.prev != head) {
-                  current.iterCount--;
-
-                  current = current.prev;
-
-                  current.iterCount++;
-               } else {
-                  current = null;
-               }
-            }
-         }
-      }
-
-      private Node<E> getNode() {
-         if (current == null) {
-            current = head.next;
-
-            if (current != null) {
-               current.iterCount++;
-            }
-         }
-
-         if (current != null) {
-            return current;
-         } else {
-            return null;
-         }
-      }
-
-      private boolean canAdvance() {
-         if (current == null) {
-            current = head.next;
-
-            if (current != null) {
-               current.iterCount++;
-            }
-         }
-
-         return current != null && current.next != null;
-      }
-
-      private void advance() {
-         if (current == null || current.next == null) {
-            throw new NoSuchElementException();
-         }
-
-         current.iterCount--;
-
-         current = current.next;
-
-         current.iterCount++;
-      }
-
-   }
-}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/LinkedListIterator.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/LinkedListIterator.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/LinkedListIterator.java
deleted file mode 100644
index 10700e5..0000000
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/LinkedListIterator.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.artemis.utils;
-
-import java.util.Iterator;
-
-/**
- * A LinkedListIterator
- *
- * This iterator allows the last element to be repeated in the next call to hasNext or next
- */
-public interface LinkedListIterator<E> extends Iterator<E>, AutoCloseable {
-
-   void repeat();
-
-   @Override
-   void close();
-}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/PriorityLinkedList.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/PriorityLinkedList.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/PriorityLinkedList.java
deleted file mode 100644
index 450f58a..0000000
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/PriorityLinkedList.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.artemis.utils;
-
-/**
- * A type of linked list which maintains items according to a priority
- * and allows adding and removing of elements at both ends, and peeking
- */
-public interface PriorityLinkedList<T> {
-
-   void addHead(T t, int priority);
-
-   void addTail(T t, int priority);
-
-   T poll();
-
-   void clear();
-
-   int size();
-
-   LinkedListIterator<T> iterator();
-
-   boolean isEmpty();
-}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/PriorityLinkedListImpl.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/PriorityLinkedListImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/PriorityLinkedListImpl.java
deleted file mode 100644
index 427a927..0000000
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/PriorityLinkedListImpl.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.artemis.utils;
-
-import java.lang.reflect.Array;
-import java.util.NoSuchElementException;
-
-/**
- * A priority linked list implementation
- * <p>
- * It implements this by maintaining an individual LinkedBlockingDeque for each priority level.
- */
-public class PriorityLinkedListImpl<T> implements PriorityLinkedList<T> {
-
-   protected LinkedListImpl<T>[] levels;
-
-   private int size;
-
-   private int lastReset;
-
-   private int highestPriority = -1;
-
-   private int lastPriority = -1;
-
-   public PriorityLinkedListImpl(final int priorities) {
-      levels = (LinkedListImpl<T>[]) Array.newInstance(LinkedListImpl.class, priorities);
-
-      for (int i = 0; i < priorities; i++) {
-         levels[i] = new LinkedListImpl<>();
-      }
-   }
-
-   private void checkHighest(final int priority) {
-      if (lastPriority != priority || priority > highestPriority) {
-         lastPriority = priority;
-         if (lastReset == Integer.MAX_VALUE) {
-            lastReset = 0;
-         } else {
-            lastReset++;
-         }
-      }
-
-      if (priority > highestPriority) {
-         highestPriority = priority;
-      }
-   }
-
-   @Override
-   public void addHead(final T t, final int priority) {
-      checkHighest(priority);
-
-      levels[priority].addHead(t);
-
-      size++;
-   }
-
-   @Override
-   public void addTail(final T t, final int priority) {
-      checkHighest(priority);
-
-      levels[priority].addTail(t);
-
-      size++;
-   }
-
-   @Override
-   public T poll() {
-      T t = null;
-
-      // We are just using a simple prioritization algorithm:
-      // Highest priority refs always get returned first.
-      // This could cause starvation of lower priority refs.
-
-      // TODO - A better prioritization algorithm
-
-      for (int i = highestPriority; i >= 0; i--) {
-         LinkedListImpl<T> ll = levels[i];
-
-         if (ll.size() != 0) {
-            t = ll.poll();
-
-            if (t != null) {
-               size--;
-
-               if (ll.size() == 0) {
-                  if (highestPriority == i) {
-                     highestPriority--;
-                  }
-               }
-            }
-
-            break;
-         }
-      }
-
-      return t;
-   }
-
-   @Override
-   public void clear() {
-      for (LinkedListImpl<T> list : levels) {
-         list.clear();
-      }
-
-      size = 0;
-   }
-
-   @Override
-   public int size() {
-      return size;
-   }
-
-   @Override
-   public boolean isEmpty() {
-      return size == 0;
-   }
-
-   @Override
-   public LinkedListIterator<T> iterator() {
-      return new PriorityLinkedListIterator();
-   }
-
-   private class PriorityLinkedListIterator implements LinkedListIterator<T> {
-
-      private int index;
-
-      private final LinkedListIterator<T>[] cachedIters = new LinkedListIterator[levels.length];
-
-      private LinkedListIterator<T> lastIter;
-
-      private int resetCount = lastReset;
-
-      volatile boolean closed = false;
-
-      PriorityLinkedListIterator() {
-         index = levels.length - 1;
-      }
-
-      @Override
-      protected void finalize() {
-         close();
-      }
-
-      @Override
-      public void repeat() {
-         if (lastIter == null) {
-            throw new NoSuchElementException();
-         }
-
-         lastIter.repeat();
-      }
-
-      @Override
-      public void close() {
-         if (!closed) {
-            closed = true;
-            lastIter = null;
-
-            for (LinkedListIterator<T> iter : cachedIters) {
-               if (iter != null) {
-                  iter.close();
-               }
-            }
-         }
-      }
-
-      private void checkReset() {
-         if (lastReset != resetCount) {
-            index = highestPriority;
-
-            resetCount = lastReset;
-         }
-      }
-
-      @Override
-      public boolean hasNext() {
-         checkReset();
-
-         while (index >= 0) {
-            lastIter = cachedIters[index];
-
-            if (lastIter == null) {
-               lastIter = cachedIters[index] = levels[index].iterator();
-            }
-
-            boolean b = lastIter.hasNext();
-
-            if (b) {
-               return true;
-            }
-
-            index--;
-
-            if (index < 0) {
-               index = levels.length - 1;
-
-               break;
-            }
-         }
-         return false;
-      }
-
-      @Override
-      public T next() {
-         if (lastIter == null) {
-            throw new NoSuchElementException();
-         }
-
-         return lastIter.next();
-      }
-
-      @Override
-      public void remove() {
-         if (lastIter == null) {
-            throw new NoSuchElementException();
-         }
-
-         lastIter.remove();
-
-         // This next statement would be the equivalent of:
-         // if (index == highestPriority && levels[index].size() == 0)
-         // However we have to keep checking all the previous levels
-         // otherwise we would cache a max that will not exist
-         // what would make us eventually having hasNext() returning false
-         // as a bug
-         // Part of the fix for HORNETQ-705
-         for (int i = index; i >= 0 && levels[index].size() == 0; i--) {
-            highestPriority = i;
-         }
-
-         size--;
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/TimeAndCounterIDGeneratorTest.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/TimeAndCounterIDGeneratorTest.java b/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/TimeAndCounterIDGeneratorTest.java
index c2ec02d..812cafc 100644
--- a/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/TimeAndCounterIDGeneratorTest.java
+++ b/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/TimeAndCounterIDGeneratorTest.java
@@ -19,8 +19,8 @@ package org.apache.activemq.artemis.util;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.activemq.artemis.utils.ConcurrentHashSet;
 import org.apache.activemq.artemis.utils.TimeAndCounterIDGenerator;
+import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/file/JDBCSequentialFileFactory.java
----------------------------------------------------------------------
diff --git a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/file/JDBCSequentialFileFactory.java b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/file/JDBCSequentialFileFactory.java
index 48cb638..dfbf1ba 100644
--- a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/file/JDBCSequentialFileFactory.java
+++ b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/file/JDBCSequentialFileFactory.java
@@ -34,7 +34,7 @@ import org.apache.activemq.artemis.core.io.nio.NIOSequentialFileFactory;
 import org.apache.activemq.artemis.core.server.ActiveMQComponent;
 import org.apache.activemq.artemis.jdbc.store.sql.SQLProvider;
 import org.apache.activemq.artemis.journal.ActiveMQJournalLogger;
-import org.apache.activemq.artemis.utils.ConcurrentHashSet;
+import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
 import org.jboss.logging.Logger;
 
 public class JDBCSequentialFileFactory implements SequentialFileFactory, ActiveMQComponent {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnection.java
----------------------------------------------------------------------
diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnection.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnection.java
index 0c6cf9d..c90e630 100644
--- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnection.java
+++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnection.java
@@ -53,9 +53,9 @@ import org.apache.activemq.artemis.core.client.impl.ClientSessionInternal;
 import org.apache.activemq.artemis.core.version.Version;
 import org.apache.activemq.artemis.reader.MessageUtil;
 import org.apache.activemq.artemis.utils.ActiveMQThreadFactory;
-import org.apache.activemq.artemis.utils.ConcurrentHashSet;
 import org.apache.activemq.artemis.utils.UUIDGenerator;
 import org.apache.activemq.artemis.utils.VersionLoader;
+import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
 
 /**
  * ActiveMQ Artemis implementation of a JMS Connection.

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQJMSProducer.java
----------------------------------------------------------------------
diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQJMSProducer.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQJMSProducer.java
index 9911302..965eefd 100644
--- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQJMSProducer.java
+++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQJMSProducer.java
@@ -39,7 +39,7 @@ import java.util.Set;
 
 import org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException;
 import org.apache.activemq.artemis.api.core.SimpleString;
-import org.apache.activemq.artemis.utils.TypedProperties;
+import org.apache.activemq.artemis.utils.collections.TypedProperties;
 
 /**
  * NOTE: this class forwards {@link #setDisableMessageID(boolean)} and

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMapMessage.java
----------------------------------------------------------------------
diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMapMessage.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMapMessage.java
index a69061e..9749328 100644
--- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMapMessage.java
+++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMapMessage.java
@@ -30,7 +30,7 @@ import org.apache.activemq.artemis.api.core.Message;
 import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.api.core.client.ClientMessage;
 import org.apache.activemq.artemis.api.core.client.ClientSession;
-import org.apache.activemq.artemis.utils.TypedProperties;
+import org.apache.activemq.artemis.utils.collections.TypedProperties;
 
 import static org.apache.activemq.artemis.reader.MapMessageUtil.readBodyMap;
 import static org.apache.activemq.artemis.reader.MapMessageUtil.writeBodyMap;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ThreadAwareContext.java
----------------------------------------------------------------------
diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ThreadAwareContext.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ThreadAwareContext.java
index c74264f..f825408 100644
--- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ThreadAwareContext.java
+++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ThreadAwareContext.java
@@ -19,7 +19,7 @@ package org.apache.activemq.artemis.jms.client;
 import javax.jms.IllegalStateException;
 import java.util.Set;
 
-import org.apache.activemq.artemis.utils.ConcurrentHashSet;
+import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
 
 /**
  * Restricts what can be called on context passed in wrapped CompletionListener.

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java
----------------------------------------------------------------------
diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java
index 2fa7108..afa39e3 100644
--- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java
+++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java
@@ -42,6 +42,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
 import org.apache.activemq.artemis.api.core.ActiveMQAddressDoesNotExistException;
 import org.apache.activemq.artemis.api.core.ActiveMQException;
 import org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration;
+import org.apache.activemq.artemis.api.core.RoutingType;
 import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.api.core.TransportConfiguration;
 import org.apache.activemq.artemis.api.core.management.AddressControl;
@@ -57,7 +58,6 @@ import org.apache.activemq.artemis.core.security.Role;
 import org.apache.activemq.artemis.core.server.ActivateCallback;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
-import org.apache.activemq.artemis.api.core.RoutingType;
 import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl;
 import org.apache.activemq.artemis.core.server.impl.AddressInfo;
 import org.apache.activemq.artemis.core.server.management.Notification;
@@ -93,8 +93,8 @@ import org.apache.activemq.artemis.spi.core.naming.BindingRegistry;
 import org.apache.activemq.artemis.utils.JsonLoader;
 import org.apache.activemq.artemis.utils.SelectorTranslator;
 import org.apache.activemq.artemis.utils.TimeAndCounterIDGenerator;
-import org.apache.activemq.artemis.utils.TypedProperties;
 import org.apache.activemq.artemis.utils.XMLUtil;
+import org.apache.activemq.artemis.utils.collections.TypedProperties;
 import org.jboss.logging.Logger;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java
index 1758999..7e8320c 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java
@@ -55,7 +55,6 @@ import org.apache.activemq.artemis.core.journal.EncodingSupport;
 import org.apache.activemq.artemis.core.journal.IOCompletion;
 import org.apache.activemq.artemis.core.journal.JournalLoadInformation;
 import org.apache.activemq.artemis.core.journal.LoaderCallback;
-import org.apache.activemq.artemis.core.persistence.Persister;
 import org.apache.activemq.artemis.core.journal.PreparedTransactionInfo;
 import org.apache.activemq.artemis.core.journal.RecordInfo;
 import org.apache.activemq.artemis.core.journal.TestableJournal;
@@ -68,17 +67,18 @@ import org.apache.activemq.artemis.core.journal.impl.dataformat.JournalDeleteRec
 import org.apache.activemq.artemis.core.journal.impl.dataformat.JournalDeleteRecordTX;
 import org.apache.activemq.artemis.core.journal.impl.dataformat.JournalInternalRecord;
 import org.apache.activemq.artemis.core.journal.impl.dataformat.JournalRollbackRecordTX;
+import org.apache.activemq.artemis.core.persistence.Persister;
 import org.apache.activemq.artemis.journal.ActiveMQJournalBundle;
 import org.apache.activemq.artemis.journal.ActiveMQJournalLogger;
 import org.apache.activemq.artemis.utils.ActiveMQThreadFactory;
-import org.apache.activemq.artemis.utils.ConcurrentHashSet;
-import org.apache.activemq.artemis.utils.collections.ConcurrentLongHashMap;
-import org.apache.activemq.artemis.utils.collections.ConcurrentLongHashSet;
 import org.apache.activemq.artemis.utils.DataConstants;
 import org.apache.activemq.artemis.utils.ExecutorFactory;
 import org.apache.activemq.artemis.utils.OrderedExecutorFactory;
 import org.apache.activemq.artemis.utils.SimpleFuture;
 import org.apache.activemq.artemis.utils.SimpleFutureImpl;
+import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
+import org.apache.activemq.artemis.utils.collections.ConcurrentLongHashMap;
+import org.apache.activemq.artemis.utils.collections.ConcurrentLongHashSet;
 import org.jboss.logging.Logger;
 
 /**

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/jms/ServerJMSMapMessage.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/jms/ServerJMSMapMessage.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/jms/ServerJMSMapMessage.java
index f72239e..c904944 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/jms/ServerJMSMapMessage.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/jms/ServerJMSMapMessage.java
@@ -28,7 +28,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException;
 import org.apache.activemq.artemis.api.core.ICoreMessage;
 import org.apache.activemq.artemis.api.core.Message;
 import org.apache.activemq.artemis.api.core.SimpleString;
-import org.apache.activemq.artemis.utils.TypedProperties;
+import org.apache.activemq.artemis.utils.collections.TypedProperties;
 
 import static org.apache.activemq.artemis.reader.MapMessageUtil.readBodyMap;
 import static org.apache.activemq.artemis.reader.MapMessageUtil.writeBodyMap;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTConnectionManager.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTConnectionManager.java b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTConnectionManager.java
index 9800be5..bd180b6 100644
--- a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTConnectionManager.java
+++ b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTConnectionManager.java
@@ -28,8 +28,8 @@ import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.core.server.ServerSession;
 import org.apache.activemq.artemis.core.server.impl.ServerSessionImpl;
-import org.apache.activemq.artemis.utils.ConcurrentHashSet;
 import org.apache.activemq.artemis.utils.UUIDGenerator;
+import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
 
 /**
  * MQTTConnectionMananager is responsible for handle Connect and Disconnect packets and any resulting behaviour of these

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTRetainMessageManager.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTRetainMessageManager.java b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTRetainMessageManager.java
index d0a3c07..a7381ea 100644
--- a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTRetainMessageManager.java
+++ b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTRetainMessageManager.java
@@ -25,7 +25,7 @@ import org.apache.activemq.artemis.core.server.Queue;
 import org.apache.activemq.artemis.core.server.RoutingContext;
 import org.apache.activemq.artemis.core.server.impl.RoutingContextImpl;
 import org.apache.activemq.artemis.core.transaction.Transaction;
-import org.apache.activemq.artemis.utils.LinkedListIterator;
+import org.apache.activemq.artemis.utils.collections.LinkedListIterator;
 
 public class MQTTRetainMessageManager {
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
index 60876b9..c63d266 100644
--- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
+++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
@@ -77,8 +77,8 @@ import org.apache.activemq.artemis.spi.core.protocol.AbstractRemotingConnection;
 import org.apache.activemq.artemis.spi.core.protocol.ConnectionEntry;
 import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
 import org.apache.activemq.artemis.spi.core.remoting.Connection;
-import org.apache.activemq.artemis.utils.ConcurrentHashSet;
 import org.apache.activemq.artemis.utils.UUIDGenerator;
+import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.ActiveMQMessage;
 import org.apache.activemq.command.ActiveMQTempQueue;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java
index f578ac8..dd7879c 100644
--- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java
+++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java
@@ -44,8 +44,8 @@ import org.apache.activemq.artemis.core.server.MessageReference;
 import org.apache.activemq.artemis.reader.MessageUtil;
 import org.apache.activemq.artemis.spi.core.protocol.MessageConverter;
 import org.apache.activemq.artemis.utils.DataConstants;
-import org.apache.activemq.artemis.utils.TypedProperties;
 import org.apache.activemq.artemis.utils.UUIDGenerator;
+import org.apache.activemq.artemis.utils.collections.TypedProperties;
 import org.apache.activemq.command.ActiveMQBytesMessage;
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.ActiveMQMapMessage;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionManager.java
----------------------------------------------------------------------
diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionManager.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionManager.java
index f895b59..bfdd0c9 100644
--- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionManager.java
+++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionManager.java
@@ -22,7 +22,7 @@ import javax.resource.spi.ConnectionRequestInfo;
 import javax.resource.spi.ManagedConnection;
 import javax.resource.spi.ManagedConnectionFactory;
 
-import org.apache.activemq.artemis.utils.ConcurrentHashSet;
+import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
 
 /**
  * The connection manager used in non-managed environments.

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/recovery/RecoveryManager.java
----------------------------------------------------------------------
diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/recovery/RecoveryManager.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/recovery/RecoveryManager.java
index 0e72780..0abde97 100644
--- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/recovery/RecoveryManager.java
+++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/recovery/RecoveryManager.java
@@ -25,7 +25,7 @@ import org.apache.activemq.artemis.ra.ActiveMQRALogger;
 import org.apache.activemq.artemis.service.extensions.xa.recovery.ActiveMQRegistry;
 import org.apache.activemq.artemis.service.extensions.xa.recovery.ActiveMQRegistryImpl;
 import org.apache.activemq.artemis.service.extensions.xa.recovery.XARecoveryConfig;
-import org.apache.activemq.artemis.utils.ConcurrentHashSet;
+import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
 
 public final class RecoveryManager {
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc26ac96/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
index ad90627..faa25cc 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
@@ -48,6 +48,7 @@ import java.util.stream.Collectors;
 import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
 import org.apache.activemq.artemis.api.core.ActiveMQAddressDoesNotExistException;
 import org.apache.activemq.artemis.api.core.ActiveMQException;
+import org.apache.activemq.artemis.api.core.RoutingType;
 import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.api.core.TransportConfiguration;
 import org.apache.activemq.artemis.api.core.management.ActiveMQServerControl;
@@ -84,7 +85,6 @@ import org.apache.activemq.artemis.core.server.Consumer;
 import org.apache.activemq.artemis.core.server.DivertConfigurationRoutingType;
 import org.apache.activemq.artemis.core.server.JournalType;
 import org.apache.activemq.artemis.core.server.Queue;
-import org.apache.activemq.artemis.api.core.RoutingType;
 import org.apache.activemq.artemis.core.server.ServerConsumer;
 import org.apache.activemq.artemis.core.server.ServerSession;
 import org.apache.activemq.artemis.core.server.cluster.ClusterConnection;
@@ -107,7 +107,7 @@ import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
 import org.apache.activemq.artemis.utils.JsonLoader;
 import org.apache.activemq.artemis.utils.ListUtil;
 import org.apache.activemq.artemis.utils.SecurityFormatter;
-import org.apache.activemq.artemis.utils.TypedProperties;
+import org.apache.activemq.artemis.utils.collections.TypedProperties;
 
 public class ActiveMQServerControlImpl extends AbstractControl implements ActiveMQServerControl, NotificationEmitter, org.apache.activemq.artemis.core.server.management.NotificationListener {
    // Constants -----------------------------------------------------