activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From michaelpea...@apache.org
Subject [1/2] activemq-artemis git commit: ARTEMIS-1606 - Change AddressInfo RoutingType Set to use EnumSet
Date Thu, 18 Jan 2018 12:36:56 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master f1608d724 -> 1d31227cd


ARTEMIS-1606 - Change AddressInfo RoutingType Set to use EnumSet

Change all use from Set<RoutingType> to EnumSet<RoutingType>
Deprecating any old exposed interfaces but keeping for back compatibility.
Address info to avoid iterator on getRoutingType hotpath, like wise can be avoided where single RoutingType is passed in.

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

Branch: refs/heads/master
Commit: fd0ba697934ee0cc00a53d1ed86994913e1d6b36
Parents: f1608d7
Author: Michael André Pearce <michael.andre.pearce@me.com>
Authored: Sat Jan 13 19:47:58 2018 +0000
Committer: Michael Pearce <michael.andre.pearce@me.com>
Committed: Thu Jan 18 13:36:09 2018 +0100

----------------------------------------------------------------------
 .../cli/commands/tools/xml/XmlDataImporter.java |  5 +--
 .../artemis/api/core/client/ClientSession.java  | 10 +++++
 .../core/client/impl/ClientSessionImpl.java     | 10 +++--
 .../core/impl/ActiveMQSessionContext.java       |  8 ++++
 .../impl/wireformat/CreateAddressMessage.java   | 13 +++---
 .../spi/core/remoting/SessionContext.java       |  3 ++
 .../activemq/artemis/utils/PrefixUtil.java      | 13 +++---
 .../core/config/CoreAddressConfiguration.java   |  7 ++-
 .../impl/ActiveMQServerControlImpl.java         |  9 ++--
 .../management/impl/AddressControlImpl.java     |  3 +-
 .../core/persistence/AddressBindingInfo.java    |  4 +-
 .../codec/PersistentAddressBindingEncoding.java | 11 +++--
 .../artemis/core/postoffice/AddressManager.java |  4 +-
 .../artemis/core/postoffice/PostOffice.java     |  4 +-
 .../core/postoffice/impl/PostOfficeImpl.java    |  6 +--
 .../postoffice/impl/SimpleAddressManager.java   |  8 ++--
 .../artemis/core/server/ActiveMQServer.java     |  4 ++
 .../artemis/core/server/ServerSession.java      |  7 +--
 .../core/server/impl/ActiveMQServerImpl.java    | 14 +++---
 .../artemis/core/server/impl/AddressInfo.java   | 45 ++++++++++----------
 .../core/server/impl/ServerSessionImpl.java     |  9 ++--
 .../integration/client/CreateQueueTest.java     |  7 ++-
 .../tests/integration/client/RoutingTest.java   | 15 ++-----
 .../integration/client/UpdateQueueTest.java     |  7 +--
 .../management/AddressControlTest.java          |  5 +--
 .../integration/mqtt/imported/MQTTTest.java     |  7 +--
 .../persistence/XmlImportExportTest.java        |  7 +--
 .../artemis/jms/tests/MessageProducerTest.java  |  7 +--
 .../jms/tests/message/MessageHeaderTest.java    |  5 +++
 .../core/server/impl/fakes/FakePostOffice.java  |  4 +-
 30 files changed, 138 insertions(+), 123 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd0ba697/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/xml/XmlDataImporter.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/xml/XmlDataImporter.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/xml/XmlDataImporter.java
index b684799..1f4062e 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/xml/XmlDataImporter.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/xml/XmlDataImporter.java
@@ -38,11 +38,10 @@ import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.Comparator;
+import java.util.EnumSet;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 import java.util.TreeSet;
 import java.util.UUID;
 
@@ -740,7 +739,7 @@ public final class XmlDataImporter extends ActionAbstract {
       ClientSession.AddressQuery addressQuery = session.addressQuery(new SimpleString(addressName));
 
       if (!addressQuery.isExists()) {
-         Set<RoutingType> set = new HashSet<>();
+         EnumSet<RoutingType> set = EnumSet.noneOf(RoutingType.class);
          for (String routingType : ListUtil.toList(routingTypes)) {
             set.add(RoutingType.valueOf(routingType));
          }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd0ba697/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ClientSession.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ClientSession.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ClientSession.java
index ab59eb6..ce56013 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ClientSession.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ClientSession.java
@@ -17,6 +17,7 @@
 package org.apache.activemq.artemis.api.core.client;
 
 import javax.transaction.xa.XAResource;
+import java.util.EnumSet;
 import java.util.List;
 import java.util.Set;
 
@@ -216,6 +217,15 @@ public interface ClientSession extends XAResource, AutoCloseable {
     * @param autoCreated
     * @throws ActiveMQException
     */
+   void createAddress(SimpleString address, EnumSet<RoutingType> routingTypes, boolean autoCreated) throws ActiveMQException;
+
+   /**
+    * Create Address with a single initial routing type
+    * @param address
+    * @param autoCreated
+    * @throws ActiveMQException
+    */
+   @Deprecated
    void createAddress(SimpleString address, Set<RoutingType> routingTypes, boolean autoCreated) throws ActiveMQException;
 
    /**

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd0ba697/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java
index b5f8a1b..e5e91db 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java
@@ -19,6 +19,7 @@ package org.apache.activemq.artemis.core.client.impl;
 import javax.transaction.xa.XAException;
 import javax.transaction.xa.XAResource;
 import javax.transaction.xa.Xid;
+import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedHashMap;
@@ -276,6 +277,11 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
 
    @Override
    public void createAddress(final SimpleString address, Set<RoutingType> routingTypes, boolean autoCreated) throws ActiveMQException {
+      createAddress(address, EnumSet.copyOf(routingTypes), autoCreated);
+   }
+
+   @Override
+   public void createAddress(final SimpleString address, EnumSet<RoutingType> routingTypes, boolean autoCreated) throws ActiveMQException {
       checkClosed();
 
       startCall();
@@ -288,9 +294,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
 
    @Override
    public void createAddress(final SimpleString address, RoutingType routingType, boolean autoCreated) throws ActiveMQException {
-      Set<RoutingType> routingTypes = new HashSet<>();
-      routingTypes.add(routingType);
-      createAddress(address, routingTypes, autoCreated);
+      createAddress(address, EnumSet.of(routingType), autoCreated);
    }
 
    @Override

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd0ba697/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java
index 1a81259..3a4878b 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java
@@ -21,6 +21,7 @@ import javax.transaction.xa.XAResource;
 import javax.transaction.xa.Xid;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -613,6 +614,13 @@ public class ActiveMQSessionContext extends SessionContext {
    public void createAddress(SimpleString address,
                              Set<RoutingType> routingTypes,
                              final boolean autoCreated) throws ActiveMQException {
+      createAddress(address, EnumSet.copyOf(routingTypes), autoCreated);
+   }
+
+   @Override
+   public void createAddress(SimpleString address,
+                             EnumSet<RoutingType> routingTypes,
+                             final boolean autoCreated) throws ActiveMQException {
       CreateAddressMessage request = new CreateAddressMessage(address, routingTypes, autoCreated, true);
       if (!sessionChannel.getConnection().isVersionBeforeAddressChange()) {
          sessionChannel.sendBlocking(request, PacketImpl.NULL_RESPONSE);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd0ba697/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateAddressMessage.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateAddressMessage.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateAddressMessage.java
index f592a4c..a98f888 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateAddressMessage.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateAddressMessage.java
@@ -16,8 +16,7 @@
  */
 package org.apache.activemq.artemis.core.protocol.core.impl.wireformat;
 
-import java.util.HashSet;
-import java.util.Set;
+import java.util.EnumSet;
 
 import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
 import org.apache.activemq.artemis.api.core.SimpleString;
@@ -28,14 +27,14 @@ public class CreateAddressMessage extends PacketImpl {
 
    private SimpleString address;
 
-   private Set<RoutingType> routingTypes;
+   private EnumSet<RoutingType> routingTypes;
 
    private boolean autoCreated;
 
    private boolean requiresResponse;
 
    public CreateAddressMessage(final SimpleString address,
-                               Set<RoutingType> routingTypes,
+                               EnumSet<RoutingType> routingTypes,
                                final boolean autoCreated,
                                final boolean requiresResponse) {
       this();
@@ -78,11 +77,11 @@ public class CreateAddressMessage extends PacketImpl {
       this.address = address;
    }
 
-   public Set<RoutingType> getRoutingTypes() {
+   public EnumSet<RoutingType> getRoutingTypes() {
       return routingTypes;
    }
 
-   public void setRoutingTypes(Set<RoutingType> routingTypes) {
+   public void setRoutingTypes(EnumSet<RoutingType> routingTypes) {
       this.routingTypes = routingTypes;
    }
 
@@ -101,7 +100,7 @@ public class CreateAddressMessage extends PacketImpl {
    public void decodeRest(final ActiveMQBuffer buffer) {
       address = buffer.readSimpleString();
       int routingTypeSetSize = buffer.readInt();
-      routingTypes = new HashSet<>(routingTypeSetSize);
+      routingTypes = EnumSet.noneOf(RoutingType.class);
       for (int i = 0; i < routingTypeSetSize; i++) {
          routingTypes.add(RoutingType.getType(buffer.readByte()));
       }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd0ba697/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/SessionContext.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/SessionContext.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/SessionContext.java
index 78135a8..1c85f08 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/SessionContext.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/SessionContext.java
@@ -18,6 +18,7 @@ package org.apache.activemq.artemis.spi.core.remoting;
 
 import javax.transaction.xa.XAException;
 import javax.transaction.xa.Xid;
+import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.Set;
 import java.util.concurrent.Executor;
@@ -185,8 +186,10 @@ public abstract class SessionContext {
 
    public abstract void deleteQueue(SimpleString queueName) throws ActiveMQException;
 
+   @Deprecated
    public abstract void createAddress(SimpleString address, Set<RoutingType> routingTypes, boolean autoCreated) throws ActiveMQException;
 
+   public abstract void createAddress(SimpleString address, EnumSet<RoutingType> routingTypes, boolean autoCreated) throws ActiveMQException;
 
    @Deprecated
    public abstract void createQueue(SimpleString address,

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd0ba697/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/PrefixUtil.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/PrefixUtil.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/PrefixUtil.java
index 5313a8a..9c6e92a 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/PrefixUtil.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/PrefixUtil.java
@@ -16,9 +16,8 @@
  */
 package org.apache.activemq.artemis.utils;
 
-import java.util.HashSet;
+import java.util.EnumSet;
 import java.util.Map;
-import java.util.Set;
 
 import org.apache.activemq.artemis.api.core.Pair;
 import org.apache.activemq.artemis.api.core.SimpleString;
@@ -26,14 +25,12 @@ import org.apache.activemq.artemis.api.core.RoutingType;
 
 public class PrefixUtil {
 
-   public static Pair<SimpleString, Set<RoutingType>> getAddressAndRoutingTypes(SimpleString address,
-                                                                          Set<RoutingType> defaultRoutingTypes,
-                                                                          Map<SimpleString, RoutingType> prefixes) {
+   public static Pair<SimpleString, EnumSet<RoutingType>> getAddressAndRoutingTypes(SimpleString address,
+                                                                                    EnumSet<RoutingType> defaultRoutingTypes,
+                                                                                    Map<SimpleString, RoutingType> prefixes) {
       for (Map.Entry<SimpleString, RoutingType> entry : prefixes.entrySet()) {
          if (address.startsWith(entry.getKey())) {
-            Set routingTypes = new HashSet<>();
-            routingTypes.add(entry.getValue());
-            return new Pair<>(removePrefix(address, entry.getKey()), routingTypes);
+            return new Pair<>(removePrefix(address, entry.getKey()), EnumSet.of(entry.getValue()));
          }
       }
       return new Pair<>(address, defaultRoutingTypes);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd0ba697/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/CoreAddressConfiguration.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/CoreAddressConfiguration.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/CoreAddressConfiguration.java
index 86bbeab..290d483 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/CoreAddressConfiguration.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/CoreAddressConfiguration.java
@@ -18,9 +18,8 @@ package org.apache.activemq.artemis.core.config;
 
 import java.io.Serializable;
 import java.util.ArrayList;
-import java.util.HashSet;
+import java.util.EnumSet;
 import java.util.List;
-import java.util.Set;
 
 import org.apache.activemq.artemis.api.core.RoutingType;
 
@@ -28,7 +27,7 @@ public class CoreAddressConfiguration implements Serializable {
 
    private String name = null;
 
-   private Set<RoutingType> routingTypes = new HashSet<>();
+   private EnumSet<RoutingType> routingTypes = EnumSet.noneOf(RoutingType.class);
 
    private List<CoreQueueConfiguration> queueConfigurations = new ArrayList<>();
 
@@ -44,7 +43,7 @@ public class CoreAddressConfiguration implements Serializable {
       return this;
    }
 
-   public Set<RoutingType> getRoutingTypes() {
+   public EnumSet<RoutingType> getRoutingTypes() {
       return routingTypes;
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd0ba697/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 6e12766..4e80bb5 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
@@ -36,6 +36,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.Date;
+import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -630,7 +631,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
          public StringBuilder format(AddressInfo addressInfo, StringBuilder output) {
             output.append("Address [name=").append(addressInfo.getName());
             output.append(", routingTypes={");
-            final Set<RoutingType> routingTypes = addressInfo.getRoutingTypes();
+            final EnumSet<RoutingType> routingTypes = addressInfo.getRoutingTypes();
             if (!routingTypes.isEmpty()) {
                for (RoutingType routingType : routingTypes) {
                   output.append(routingType).append(',');
@@ -680,7 +681,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
 
       clearIO();
       try {
-         Set<RoutingType> set = new HashSet<>();
+         EnumSet<RoutingType> set = EnumSet.noneOf(RoutingType.class);
          for (String routingType : ListUtil.toList(routingTypes)) {
             set.add(RoutingType.valueOf(routingType));
          }
@@ -701,11 +702,11 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
 
       clearIO();
       try {
-         final Set<RoutingType> routingTypeSet;
+         final EnumSet<RoutingType> routingTypeSet;
          if (routingTypes == null) {
             routingTypeSet = null;
          } else {
-            routingTypeSet = new HashSet<>();
+            routingTypeSet = EnumSet.noneOf(RoutingType.class);
             final String[] routingTypeNames = routingTypes.split(",");
             for (String routingTypeName : routingTypeNames) {
                routingTypeSet.add(RoutingType.valueOf(routingTypeName));

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd0ba697/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java
index 04b0e4b..82c6a6c 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java
@@ -21,6 +21,7 @@ import javax.management.MBeanAttributeInfo;
 import javax.management.MBeanOperationInfo;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.EnumSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -100,7 +101,7 @@ public class AddressControlImpl extends AbstractControl implements AddressContro
 
    @Override
    public String[] getRoutingTypes() {
-      Set<RoutingType> routingTypes = addressInfo.getRoutingTypes();
+      EnumSet<RoutingType> routingTypes = addressInfo.getRoutingTypes();
       String[] result = new String[routingTypes.size()];
       int i = 0;
       for (RoutingType routingType : routingTypes) {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd0ba697/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/AddressBindingInfo.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/AddressBindingInfo.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/AddressBindingInfo.java
index 381d627..902c16b 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/AddressBindingInfo.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/AddressBindingInfo.java
@@ -16,7 +16,7 @@
  */
 package org.apache.activemq.artemis.core.persistence;
 
-import java.util.Set;
+import java.util.EnumSet;
 
 import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.api.core.RoutingType;
@@ -27,5 +27,5 @@ public interface AddressBindingInfo {
 
    SimpleString getName();
 
-   Set<RoutingType> getRoutingTypes();
+   EnumSet<RoutingType> getRoutingTypes();
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd0ba697/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PersistentAddressBindingEncoding.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PersistentAddressBindingEncoding.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PersistentAddressBindingEncoding.java
index 3e5012a..3ed3f96 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PersistentAddressBindingEncoding.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PersistentAddressBindingEncoding.java
@@ -16,8 +16,7 @@
  */
 package org.apache.activemq.artemis.core.persistence.impl.journal.codec;
 
-import java.util.HashSet;
-import java.util.Set;
+import java.util.EnumSet;
 
 import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
 import org.apache.activemq.artemis.api.core.SimpleString;
@@ -34,10 +33,10 @@ public class PersistentAddressBindingEncoding implements EncodingSupport, Addres
 
    public boolean autoCreated;
 
-   public Set<RoutingType> routingTypes;
+   public EnumSet<RoutingType> routingTypes;
 
    public PersistentAddressBindingEncoding() {
-      routingTypes = new HashSet<>();
+      routingTypes = EnumSet.noneOf(RoutingType.class);
    }
 
    @Override
@@ -57,7 +56,7 @@ public class PersistentAddressBindingEncoding implements EncodingSupport, Addres
    }
 
    public PersistentAddressBindingEncoding(final SimpleString name,
-                                           final Set<RoutingType> routingTypes,
+                                           final EnumSet<RoutingType> routingTypes,
                                            final boolean autoCreated) {
       this.name = name;
       this.routingTypes = routingTypes;
@@ -79,7 +78,7 @@ public class PersistentAddressBindingEncoding implements EncodingSupport, Addres
    }
 
    @Override
-   public Set<RoutingType> getRoutingTypes() {
+   public EnumSet<RoutingType> getRoutingTypes() {
       return routingTypes;
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd0ba697/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/AddressManager.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/AddressManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/AddressManager.java
index aa4af0e..dbf1ef7 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/AddressManager.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/AddressManager.java
@@ -16,7 +16,7 @@
  */
 package org.apache.activemq.artemis.core.postoffice;
 
-import java.util.Collection;
+import java.util.EnumSet;
 import java.util.Map;
 import java.util.Set;
 
@@ -68,7 +68,7 @@ public interface AddressManager {
 
    /** it will return null if there are no updates.
     *  it will throw an exception if the address doesn't exist */
-   AddressInfo updateAddressInfo(SimpleString addressName, Collection<RoutingType> routingTypes) throws Exception;
+   AddressInfo updateAddressInfo(SimpleString addressName, EnumSet<RoutingType> routingTypes) throws Exception;
 
    AddressInfo removeAddressInfo(SimpleString address) throws Exception;
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd0ba697/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/PostOffice.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/PostOffice.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/PostOffice.java
index b27d726..9eee907 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/PostOffice.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/PostOffice.java
@@ -16,7 +16,7 @@
  */
 package org.apache.activemq.artemis.core.postoffice;
 
-import java.util.Collection;
+import java.util.EnumSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -59,7 +59,7 @@ public interface PostOffice extends ActiveMQComponent {
 
    AddressInfo getAddressInfo(SimpleString address);
 
-   AddressInfo updateAddressInfo(SimpleString addressName, Collection<RoutingType> routingTypes) throws Exception;
+   AddressInfo updateAddressInfo(SimpleString addressName, EnumSet<RoutingType> routingTypes) throws Exception;
 
    QueueBinding updateQueue(SimpleString name,
                             RoutingType routingType,

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd0ba697/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 d5af56b..50f2b58 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
@@ -17,8 +17,8 @@
 package org.apache.activemq.artemis.core.postoffice.impl;
 
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.Collections;
+import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -478,7 +478,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding
          if (routingType != null) {
             final SimpleString address = queue.getAddress();
             final AddressInfo addressInfo = addressManager.getAddressInfo(address);
-            final Set<RoutingType> addressRoutingTypes = addressInfo.getRoutingTypes();
+            final EnumSet<RoutingType> addressRoutingTypes = addressInfo.getRoutingTypes();
             if (!addressRoutingTypes.contains(routingType)) {
                throw ActiveMQMessageBundle.BUNDLE.invalidRoutingTypeUpdate(name.toString(), routingType, address.toString(), addressRoutingTypes);
             }
@@ -516,7 +516,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding
 
    @Override
    public AddressInfo updateAddressInfo(SimpleString addressName,
-                                        Collection<RoutingType> routingTypes) throws Exception {
+                                        EnumSet<RoutingType> routingTypes) throws Exception {
 
       synchronized (addressLock) {
          return addressManager.updateAddressInfo(addressName, routingTypes);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd0ba697/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/SimpleAddressManager.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/SimpleAddressManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/SimpleAddressManager.java
index f1ca5ae..72f6692 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/SimpleAddressManager.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/SimpleAddressManager.java
@@ -258,7 +258,7 @@ public class SimpleAddressManager implements AddressManager {
 
    @Override
    public AddressInfo updateAddressInfo(SimpleString addressName,
-                                        Collection<RoutingType> routingTypes) throws Exception {
+                                        EnumSet<RoutingType> routingTypes) throws Exception {
 
       AddressInfo info = addressInfoMap.get(addressName);
 
@@ -272,7 +272,7 @@ public class SimpleAddressManager implements AddressManager {
       }
 
       validateRoutingTypes(addressName, routingTypes);
-      final Set<RoutingType> updatedRoutingTypes = EnumSet.copyOf(routingTypes);
+      final EnumSet<RoutingType> updatedRoutingTypes = EnumSet.copyOf(routingTypes);
       info.setRoutingTypes(updatedRoutingTypes);
 
 
@@ -294,7 +294,7 @@ public class SimpleAddressManager implements AddressManager {
       return info;
    }
 
-   private boolean isEquals(Collection<RoutingType> set1, Collection<RoutingType> set2) {
+   private boolean isEquals(Collection<RoutingType> set1, EnumSet<RoutingType> set2) {
       Set<RoutingType> eset1 = set1 == null || set1.isEmpty() ? Collections.emptySet() : EnumSet.copyOf(set1);
       Set<RoutingType> eset2 = set2 == null || set2.isEmpty() ? Collections.emptySet() : EnumSet.copyOf(set2);
 
@@ -309,7 +309,7 @@ public class SimpleAddressManager implements AddressManager {
       return eset2.containsAll(eset1);
    }
 
-   private void validateRoutingTypes(SimpleString addressName, Collection<RoutingType> routingTypes) {
+   private void validateRoutingTypes(SimpleString addressName, EnumSet<RoutingType> routingTypes) {
       final Bindings bindings = this.mappings.get(addressName);
       if (bindings != null) {
          for (Binding binding : bindings.getBindings()) {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd0ba697/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java
index 5eeb3db..d1d3029 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java
@@ -17,6 +17,7 @@
 package org.apache.activemq.artemis.core.server;
 
 import java.util.Collection;
+import java.util.EnumSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -442,6 +443,9 @@ public interface ActiveMQServer extends ServiceComponent {
     * @return {@code true} if the {@code AddressInfo} was updated, {@code false} otherwise
     * @throws Exception
     */
+   boolean updateAddressInfo(SimpleString address, EnumSet<RoutingType> routingTypes) throws Exception;
+
+   @Deprecated
    boolean updateAddressInfo(SimpleString address, Collection<RoutingType> routingTypes) throws Exception;
 
    /**

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd0ba697/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerSession.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerSession.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerSession.java
index 32e35c1..d7e1ad2 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerSession.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerSession.java
@@ -18,6 +18,7 @@ package org.apache.activemq.artemis.core.server;
 
 import javax.json.JsonArrayBuilder;
 import javax.transaction.xa.Xid;
+import java.util.EnumSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -164,7 +165,7 @@ public interface ServerSession extends SecurityAuth {
                      boolean autoCreated) throws Exception;
 
    AddressInfo createAddress(SimpleString address,
-                             Set<RoutingType> routingTypes,
+                             EnumSet<RoutingType> routingTypes,
                              boolean autoCreated) throws Exception;
 
    AddressInfo createAddress(SimpleString address,
@@ -302,8 +303,8 @@ public interface ServerSession extends SecurityAuth {
     *         name and the {@code java.util.Set} of {@code org.apache.activemq.artemis.api.core.RoutingType} objects
     *         corresponding to the that prefix.
     */
-   Pair<SimpleString, Set<RoutingType>> getAddressAndRoutingTypes(SimpleString address,
-                                                                  Set<RoutingType> defaultRoutingTypes);
+   Pair<SimpleString, EnumSet<RoutingType>> getAddressAndRoutingTypes(SimpleString address,
+                                                                      EnumSet<RoutingType> defaultRoutingTypes);
 
    void addProducer(ServerProducer serverProducer);
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd0ba697/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 a89a43b..d6230e3 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
@@ -28,6 +28,7 @@ import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Date;
+import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedList;
@@ -2618,7 +2619,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
    }
 
    @Override
-   public boolean updateAddressInfo(SimpleString address, Collection<RoutingType> routingTypes) throws Exception {
+   public boolean updateAddressInfo(SimpleString address, EnumSet<RoutingType> routingTypes) throws Exception {
       if (getAddressInfo(address) == null) {
          return false;
       }
@@ -2629,6 +2630,11 @@ public class ActiveMQServerImpl implements ActiveMQServer {
    }
 
    @Override
+   public boolean updateAddressInfo(SimpleString address, Collection<RoutingType> routingTypes) throws Exception {
+      return updateAddressInfo(address, EnumSet.copyOf(routingTypes));
+   }
+
+   @Override
    public boolean addAddressInfo(AddressInfo addressInfo) throws Exception {
       boolean result = postOffice.addAddressInfo(addressInfo);
 
@@ -2715,8 +2721,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
             addressInfo.setInternal(addrInfo == null ? false : addrInfo.isInternal());
             addAddressInfo(addressInfo);
          } else if (!info.getRoutingTypes().contains(rt)) {
-            Set<RoutingType> routingTypes = new HashSet<>();
-            routingTypes.addAll(info.getRoutingTypes());
+            EnumSet<RoutingType> routingTypes = EnumSet.copyOf(info.getRoutingTypes());
             routingTypes.add(rt);
             updateAddressInfo(info.getName(), routingTypes);
          }
@@ -2823,8 +2828,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
             addressInfo.setAutoCreated(true);
             addAddressInfo(addressInfo);
          } else if (!info.getRoutingTypes().contains(routingType)) {
-            Set<RoutingType> routingTypes = new HashSet<>();
-            routingTypes.addAll(info.getRoutingTypes());
+            EnumSet<RoutingType> routingTypes = EnumSet.copyOf(info.getRoutingTypes());
             routingTypes.add(routingType);
             updateAddressInfo(info.getName(), routingTypes);
          }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd0ba697/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AddressInfo.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AddressInfo.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AddressInfo.java
index 8a7691e..4bc540f 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AddressInfo.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AddressInfo.java
@@ -20,9 +20,8 @@ import org.apache.activemq.artemis.api.core.RoutingType;
 import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.utils.PrefixUtil;
 
-import java.util.HashSet;
+import java.util.EnumSet;
 import java.util.Map;
-import java.util.Set;
 
 public class AddressInfo {
 
@@ -32,12 +31,13 @@ public class AddressInfo {
 
    private boolean autoCreated = false;
 
-   private Set<RoutingType> routingTypes;
+   private EnumSet<RoutingType> routingTypes;
+   private RoutingType firstSeen;
 
    private boolean internal = false;
 
    public AddressInfo(SimpleString name) {
-      this(name, new HashSet<>());
+      this(name, EnumSet.noneOf(RoutingType.class));
    }
 
    /**
@@ -45,9 +45,9 @@ public class AddressInfo {
     * @param name
     * @param routingTypes
     */
-   public AddressInfo(SimpleString name, Set<RoutingType> routingTypes) {
+   public AddressInfo(SimpleString name, EnumSet<RoutingType> routingTypes) {
       this.name = name;
-      this.routingTypes = routingTypes;
+      setRoutingTypes(routingTypes);
    }
 
    /**
@@ -57,8 +57,7 @@ public class AddressInfo {
     */
    public AddressInfo(SimpleString name, RoutingType routingType) {
       this.name = name;
-      this.routingTypes = new HashSet<>();
-      routingTypes.add(routingType);
+      addRoutingType(routingType);
    }
 
    public boolean isAutoCreated() {
@@ -82,33 +81,35 @@ public class AddressInfo {
       return id;
    }
 
-   public Set<RoutingType> getRoutingTypes() {
+   public EnumSet<RoutingType> getRoutingTypes() {
       return routingTypes;
    }
 
-   public AddressInfo setRoutingTypes(Set<RoutingType> routingTypes) {
+   public AddressInfo setRoutingTypes(EnumSet<RoutingType> routingTypes) {
       this.routingTypes = routingTypes;
+      if (!routingTypes.isEmpty()) {
+         this.firstSeen = this.routingTypes.iterator().next();
+      }
       return this;
    }
 
    public AddressInfo addRoutingType(RoutingType routingType) {
-      if (routingTypes == null) {
-         routingTypes = new HashSet<>();
+      if (routingType != null) {
+         if (routingTypes == null) {
+            routingTypes = EnumSet.of(routingType);
+            firstSeen = routingType;
+         } else {
+            if (routingTypes.isEmpty()) {
+               firstSeen = routingType;
+            }
+            routingTypes.add(routingType);
+         }
       }
-      routingTypes.add(routingType);
       return this;
    }
 
    public RoutingType getRoutingType() {
-      /* We want to use a Set to guarantee only a single entry for ANYCAST, MULTICAST can be added to routing types.
-         There are cases where we also want to get any routing type (when a queue doesn't specifyc it's routing type for
-         example.  For this reason we return the first element in the Set.
-         */
-      // TODO There must be a better way of doing this.  This creates an iterator on each lookup.
-      for (RoutingType routingType : routingTypes) {
-         return routingType;
-      }
-      return null;
+      return firstSeen;
    }
 
    @Override

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd0ba697/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 ad59acb..a2fb933 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
@@ -22,6 +22,7 @@ import javax.transaction.xa.XAException;
 import javax.transaction.xa.Xid;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -636,9 +637,9 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
 
    @Override
    public AddressInfo createAddress(final SimpleString address,
-                                    Set<RoutingType> routingTypes,
+                                    EnumSet<RoutingType> routingTypes,
                                     final boolean autoCreated) throws Exception {
-      Pair<SimpleString, Set<RoutingType>> art = getAddressAndRoutingTypes(address, routingTypes);
+      Pair<SimpleString, EnumSet<RoutingType>> art = getAddressAndRoutingTypes(address, routingTypes);
       securityCheck(art.getA(), CheckType.CREATE_ADDRESS, this);
       server.addOrUpdateAddressInfo(new AddressInfo(art.getA(), art.getB()).setAutoCreated(autoCreated));
       return server.getAddressInfo(art.getA());
@@ -1773,8 +1774,8 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
    }
 
    @Override
-   public Pair<SimpleString, Set<RoutingType>> getAddressAndRoutingTypes(SimpleString address,
-                                                                         Set<RoutingType> defaultRoutingTypes) {
+   public Pair<SimpleString, EnumSet<RoutingType>> getAddressAndRoutingTypes(SimpleString address,
+                                                                         EnumSet<RoutingType> defaultRoutingTypes) {
       if (prefixEnabled) {
          return PrefixUtil.getAddressAndRoutingTypes(address, defaultRoutingTypes, prefixes);
       }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd0ba697/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/CreateQueueTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/CreateQueueTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/CreateQueueTest.java
index 5581d18..13d71b3 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/CreateQueueTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/CreateQueueTest.java
@@ -16,6 +16,7 @@
  */
 package org.apache.activemq.artemis.tests.integration.client;
 
+import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -62,8 +63,7 @@ public class CreateQueueTest extends ActiveMQTestBase {
       server.getAddressSettingsRepository().addMatch(addressA.toString(), new AddressSettings().setAutoCreateAddresses(false));
       server.getAddressSettingsRepository().addMatch(addressB.toString(), new AddressSettings().setAutoCreateAddresses(false));
 
-      Set<RoutingType> routingTypes = new HashSet<>();
-      routingTypes.add(RoutingType.ANYCAST);
+      EnumSet<RoutingType> routingTypes = EnumSet.of(RoutingType.ANYCAST);
       sendSession.createAddress(addressA, routingTypes, false);
       try {
          sendSession.createQueue(addressA, RoutingType.MULTICAST, queueA);
@@ -74,8 +74,7 @@ public class CreateQueueTest extends ActiveMQTestBase {
          assertEquals(ActiveMQExceptionType.INTERNAL_ERROR, ae.getType());
       }
 
-      routingTypes = new HashSet<>();
-      routingTypes.add(RoutingType.MULTICAST);
+      routingTypes = EnumSet.of(RoutingType.ANYCAST, RoutingType.MULTICAST);
       sendSession.createAddress(addressB, routingTypes, false);
       try {
          sendSession.createQueue(addressB, RoutingType.ANYCAST, queueB);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd0ba697/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/RoutingTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/RoutingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/RoutingTest.java
index 6e95620..7e058d8 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/RoutingTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/RoutingTest.java
@@ -16,8 +16,7 @@
  */
 package org.apache.activemq.artemis.tests.integration.client;
 
-import java.util.HashSet;
-import java.util.Set;
+import java.util.EnumSet;
 
 import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.api.core.client.ClientConsumer;
@@ -227,9 +226,7 @@ public class RoutingTest extends ActiveMQTestBase {
    @Test
    public void testAnycastMessageRoutingExclusivity() throws Exception {
       ClientSession sendSession = cf.createSession(false, true, true);
-      Set<RoutingType> routingTypes = new HashSet<>();
-      routingTypes.add(RoutingType.ANYCAST);
-      routingTypes.add(RoutingType.MULTICAST);
+      EnumSet<RoutingType> routingTypes = EnumSet.of(RoutingType.ANYCAST, RoutingType.MULTICAST);
       sendSession.createAddress(addressA, routingTypes, false);
       sendSession.createQueue(addressA, RoutingType.ANYCAST, queueA);
       sendSession.createQueue(addressA, RoutingType.ANYCAST, queueB);
@@ -246,9 +243,7 @@ public class RoutingTest extends ActiveMQTestBase {
    @Test
    public void testMulticastMessageRoutingExclusivity() throws Exception {
       ClientSession sendSession = cf.createSession(false, true, true);
-      Set<RoutingType> routingTypes = new HashSet<>();
-      routingTypes.add(RoutingType.ANYCAST);
-      routingTypes.add(RoutingType.MULTICAST);
+      EnumSet<RoutingType> routingTypes = EnumSet.of(RoutingType.ANYCAST, RoutingType.MULTICAST);
       sendSession.createAddress(addressA, routingTypes, false);
       sendSession.createQueue(addressA, RoutingType.ANYCAST, queueA);
       sendSession.createQueue(addressA, RoutingType.MULTICAST, queueB);
@@ -265,9 +260,7 @@ public class RoutingTest extends ActiveMQTestBase {
    @Test
    public void testAmbiguousMessageRouting() throws Exception {
       ClientSession sendSession = cf.createSession(false, true, true);
-      Set<RoutingType> routingTypes = new HashSet<>();
-      routingTypes.add(RoutingType.ANYCAST);
-      routingTypes.add(RoutingType.MULTICAST);
+      EnumSet<RoutingType> routingTypes = EnumSet.of(RoutingType.ANYCAST, RoutingType.MULTICAST);
       sendSession.createAddress(addressA, routingTypes, false);
       sendSession.createQueue(addressA, RoutingType.ANYCAST, queueA);
       sendSession.createQueue(addressA, RoutingType.ANYCAST, queueB);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd0ba697/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/UpdateQueueTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/UpdateQueueTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/UpdateQueueTest.java
index 73b352a..5d1763f 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/UpdateQueueTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/UpdateQueueTest.java
@@ -22,9 +22,8 @@ import javax.jms.MessageConsumer;
 import javax.jms.MessageProducer;
 import javax.jms.Session;
 
+import java.util.EnumSet;
 import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Set;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.activemq.artemis.api.core.RoutingType;
@@ -133,9 +132,7 @@ public class UpdateQueueTest extends ActiveMQTestBase {
 
       Assert.assertEquals(infoAdded.getId(), infoAfterRestart.getId());
 
-      Set<RoutingType> completeSet = new HashSet<>();
-      completeSet.add(RoutingType.ANYCAST);
-      completeSet.add(RoutingType.MULTICAST);
+      EnumSet<RoutingType> completeSet = EnumSet.allOf(RoutingType.class);
 
       server.updateAddressInfo(ADDRESS, completeSet);
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd0ba697/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlTest.java
index d466341..9f66bcf 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlTest.java
@@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration.management;
 import javax.json.JsonArray;
 import javax.json.JsonString;
 import java.util.Arrays;
+import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -295,9 +296,7 @@ public class AddressControlTest extends ManagementTestBase {
       Assert.assertEquals(RoutingType.ANYCAST.toString(), routingTypes[0]);
 
       address = RandomUtil.randomSimpleString();
-      Set<RoutingType> types = new HashSet<>();
-      types.add(RoutingType.ANYCAST);
-      types.add(RoutingType.MULTICAST);
+      EnumSet<RoutingType> types = EnumSet.of(RoutingType.ANYCAST, RoutingType.MULTICAST);
       session.createAddress(address, types, false);
 
       addressControl = createManagementControl(address);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd0ba697/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 6311058..d5978b0 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
@@ -28,11 +28,10 @@ import java.net.ProtocolException;
 import java.net.URI;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.HashSet;
+import java.util.EnumSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Random;
-import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
@@ -1805,9 +1804,7 @@ public class MQTTTest extends MQTTTestSupport {
    public void testAmbiguousRoutingWithMQTT() throws Exception {
       String anycastAddress = "foo/bar";
 
-      Set<RoutingType> routingTypeSet = new HashSet<>();
-      routingTypeSet.add(RoutingType.ANYCAST);
-      routingTypeSet.add(RoutingType.MULTICAST);
+      EnumSet<RoutingType> routingTypeSet = EnumSet.of(RoutingType.ANYCAST, RoutingType.MULTICAST);
 
       getServer().addAddressInfo(new AddressInfo(SimpleString.toSimpleString("foo.bar"), routingTypeSet));
       String clientId = "testMqtt";

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd0ba697/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/XmlImportExportTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/XmlImportExportTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/XmlImportExportTest.java
index aaf29b0..a041619 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/XmlImportExportTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/XmlImportExportTest.java
@@ -27,8 +27,7 @@ import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
+import java.util.EnumSet;
 import java.util.UUID;
 
 import org.apache.activemq.artemis.api.core.Message;
@@ -1006,9 +1005,7 @@ public class XmlImportExportTest extends ActiveMQTestBase {
       SimpleString myAddress = SimpleString.toSimpleString("myAddress");
       ClientSession session = basicSetUp();
 
-      Set<RoutingType> routingTypes = new HashSet<>();
-      routingTypes.add(RoutingType.ANYCAST);
-      routingTypes.add(RoutingType.MULTICAST);
+      EnumSet<RoutingType> routingTypes = EnumSet.of(RoutingType.ANYCAST, RoutingType.MULTICAST);
 
       session.createAddress(myAddress, routingTypes, false);
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd0ba697/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/MessageProducerTest.java
----------------------------------------------------------------------
diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/MessageProducerTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/MessageProducerTest.java
index a674aef..d0a87cf 100644
--- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/MessageProducerTest.java
+++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/MessageProducerTest.java
@@ -30,8 +30,7 @@ import javax.jms.Session;
 import javax.jms.TextMessage;
 import javax.jms.Topic;
 import java.io.Serializable;
-import java.util.HashSet;
-import java.util.Set;
+import java.util.EnumSet;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
@@ -710,9 +709,7 @@ public class MessageProducerTest extends JMSTestCase {
    public void testSendToQueueOnlyWhenTopicWithSameAddress() throws Exception {
       SimpleString addr = SimpleString.toSimpleString("testAddr");
 
-      Set<RoutingType> supportedRoutingTypes = new HashSet<>();
-      supportedRoutingTypes.add(RoutingType.ANYCAST);
-      supportedRoutingTypes.add(RoutingType.MULTICAST);
+      EnumSet<RoutingType> supportedRoutingTypes = EnumSet.of(RoutingType.ANYCAST, RoutingType.MULTICAST);
 
       servers.get(0).getActiveMQServer().addAddressInfo(new AddressInfo(addr, supportedRoutingTypes));
       servers.get(0).getActiveMQServer().createQueue(addr, RoutingType.ANYCAST, addr, null, false, false);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd0ba697/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/MessageHeaderTest.java
----------------------------------------------------------------------
diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/MessageHeaderTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/MessageHeaderTest.java
index 39ea0e3..6e1fff2 100644
--- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/MessageHeaderTest.java
+++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/MessageHeaderTest.java
@@ -32,6 +32,7 @@ import javax.transaction.xa.XAResource;
 import javax.transaction.xa.Xid;
 import java.io.File;
 import java.io.Serializable;
+import java.util.EnumSet;
 import java.util.Enumeration;
 import java.util.HashSet;
 import java.util.Set;
@@ -1371,6 +1372,10 @@ public class MessageHeaderTest extends MessageHeaderTestBase {
          return 0;
       }
 
+      @Override
+      public void createAddress(SimpleString address, EnumSet<RoutingType> routingTypes, boolean autoCreated) throws ActiveMQException {
+      }
+
       /**
        * Create Address with a single initial routing type
        *

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd0ba697/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakePostOffice.java
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakePostOffice.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakePostOffice.java
index 109a336..f9e413a 100644
--- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakePostOffice.java
+++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakePostOffice.java
@@ -16,7 +16,7 @@
  */
 package org.apache.activemq.artemis.tests.unit.core.server.impl.fakes;
 
-import java.util.Collection;
+import java.util.EnumSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -52,7 +52,7 @@ public class FakePostOffice implements PostOffice {
 
    @Override
    public AddressInfo updateAddressInfo(SimpleString addressName,
-                                        Collection<RoutingType> routingTypes) throws Exception {
+                                        EnumSet<RoutingType> routingTypes) throws Exception {
       return null;
    }
 


Mime
View raw message