diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/FactoryFinder.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/FactoryFinder.java index 4af3203eaf..b26a71e35b 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/FactoryFinder.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/FactoryFinder.java @@ -21,6 +21,7 @@ import java.io.IOException; import java.io.InputStream; import java.util.Properties; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; public class FactoryFinder { @@ -51,7 +52,7 @@ public class FactoryFinder */ protected static class StandaloneObjectFactory implements ObjectFactory { - final ConcurrentHashMap classMap = new ConcurrentHashMap(); + final ConcurrentMap classMap = new ConcurrentHashMap(); public Object create(final String path) throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException { diff --git a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTSessionState.java b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTSessionState.java index 38fea75506..d6bbd44221 100644 --- a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTSessionState.java +++ b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTSessionState.java @@ -35,12 +35,12 @@ public class MQTTSessionState private ServerMessage willMessage; - private final ConcurrentHashMap subscriptions = new ConcurrentHashMap<>(); + private final ConcurrentMap subscriptions = new ConcurrentHashMap<>(); // Used to store Packet ID of Publish QoS1 and QoS2 message. See spec: 4.3.3 QoS 2: Exactly once delivery. Method B. private Map messageRefStore; - private ConcurrentHashMap> addressMessageMap; + private ConcurrentMap> addressMessageMap; private Set pubRec; @@ -53,7 +53,7 @@ public class MQTTSessionState // Objects track the Outbound message references private Map> outboundMessageReferenceStore; - private ConcurrentMap> reverseOutboundReferenceStore; + private ConcurrentMap> reverseOutboundReferenceStore; private final Object outboundLock = new Object(); diff --git a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTSubscriptionManager.java b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTSubscriptionManager.java index e7ac143270..c5239388f2 100644 --- a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTSubscriptionManager.java +++ b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTSubscriptionManager.java @@ -25,14 +25,15 @@ import org.apache.activemq.artemis.core.server.ServerConsumer; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; public class MQTTSubscriptionManager { private MQTTSession session; - private ConcurrentHashMap consumerQoSLevels; + private ConcurrentMap consumerQoSLevels; - private ConcurrentHashMap consumers; + private ConcurrentMap consumers; private MQTTLogger log = MQTTLogger.LOGGER; diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java index a34168c9a8..15cb9e2be0 100644 --- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java +++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java @@ -26,6 +26,7 @@ import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; import java.util.concurrent.CopyOnWriteArrayList; import io.netty.channel.ChannelPipeline; @@ -117,7 +118,7 @@ public class OpenWireProtocolManager implements ProtocolManager, No private final CopyOnWriteArrayList connections = new CopyOnWriteArrayList(); - protected final ConcurrentHashMap connectionInfos = new ConcurrentHashMap(); + protected final ConcurrentMap connectionInfos = new ConcurrentHashMap(); private final Map clientIdSet = new HashMap(); diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConnectionContext.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConnectionContext.java index def94b6c65..a219bb2099 100644 --- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConnectionContext.java +++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConnectionContext.java @@ -17,7 +17,7 @@ package org.apache.activemq.artemis.core.protocol.openwire.amq; import java.io.IOException; -import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicBoolean; import org.apache.activemq.broker.region.MessageReference; @@ -38,7 +38,7 @@ public class AMQConnectionContext private OpenWireProtocolManager broker; //use protocol manager to represent the broker private boolean inRecoveryMode; private AMQTransaction transaction; - private ConcurrentHashMap transactions; + private ConcurrentMap transactions; private AMQSecurityContext securityContext; private ConnectionId connectionId; private String clientId; @@ -216,13 +216,13 @@ public class AMQConnectionContext this.inRecoveryMode = inRecoveryMode; } - public ConcurrentHashMap getTransactions() + public ConcurrentMap getTransactions() { return transactions; } public void setTransactions( - ConcurrentHashMap transactions) + ConcurrentMap transactions) { this.transactions = transactions; } diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSecurityContext.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSecurityContext.java index f51a636759..8cc6238468 100644 --- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSecurityContext.java +++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSecurityContext.java @@ -22,6 +22,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; import org.apache.activemq.command.ActiveMQDestination; @@ -45,8 +46,8 @@ public abstract class AMQSecurityContext final String userName; - final ConcurrentHashMap authorizedReadDests = new ConcurrentHashMap(); - final ConcurrentHashMap authorizedWriteDests = new ConcurrentHashMap(); + final ConcurrentMap authorizedReadDests = new ConcurrentHashMap(); + final ConcurrentMap authorizedWriteDests = new ConcurrentHashMap(); public AMQSecurityContext(String userName) { @@ -77,12 +78,12 @@ public abstract class AMQSecurityContext return userName; } - public ConcurrentHashMap getAuthorizedReadDests() + public ConcurrentMap getAuthorizedReadDests() { return authorizedReadDests; } - public ConcurrentHashMap getAuthorizedWriteDests() + public ConcurrentMap getAuthorizedWriteDests() { return authorizedWriteDests; } diff --git a/artemis-protocols/artemis-proton-plug/src/test/java/org/proton/plug/test/minimalserver/DumbServer.java b/artemis-protocols/artemis-proton-plug/src/test/java/org/proton/plug/test/minimalserver/DumbServer.java index 452c949fe3..e615a4c247 100644 --- a/artemis-protocols/artemis-proton-plug/src/test/java/org/proton/plug/test/minimalserver/DumbServer.java +++ b/artemis-protocols/artemis-proton-plug/src/test/java/org/proton/plug/test/minimalserver/DumbServer.java @@ -18,11 +18,12 @@ package org.proton.plug.test.minimalserver; import java.util.concurrent.BlockingDeque; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; import java.util.concurrent.LinkedBlockingDeque; public class DumbServer { - static ConcurrentHashMap> maps = new ConcurrentHashMap<>(); + static ConcurrentMap> maps = new ConcurrentHashMap<>(); public static BlockingDeque getQueue(String name) { diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/ConsumersResource.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/ConsumersResource.java index 4b4214d25e..9e73b02dc8 100644 --- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/ConsumersResource.java +++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/ConsumersResource.java @@ -30,6 +30,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.UriBuilder; import javax.ws.rs.core.UriInfo; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicLong; import org.apache.activemq.artemis.api.core.ActiveMQException; @@ -39,7 +40,7 @@ import org.apache.activemq.artemis.rest.util.TimeoutTask; public class ConsumersResource implements TimeoutTask.Callback { - protected ConcurrentHashMap queueConsumers = new ConcurrentHashMap(); + protected ConcurrentMap queueConsumers = new ConcurrentHashMap(); protected ClientSessionFactory sessionFactory; protected String destination; protected final String startup = Long.toString(System.currentTimeMillis()); diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/SubscriptionsResource.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/SubscriptionsResource.java index 55bb64abab..444e8f42c2 100644 --- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/SubscriptionsResource.java +++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/SubscriptionsResource.java @@ -30,6 +30,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.UriBuilder; import javax.ws.rs.core.UriInfo; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicLong; import org.apache.activemq.artemis.api.core.ActiveMQException; @@ -45,7 +46,7 @@ import org.apache.activemq.artemis.rest.util.TimeoutTask; public class SubscriptionsResource implements TimeoutTask.Callback { - protected ConcurrentHashMap queueConsumers = new ConcurrentHashMap(); + protected ConcurrentMap queueConsumers = new ConcurrentHashMap(); protected ClientSessionFactory sessionFactory; protected String destination; protected final String startup = Long.toString(System.currentTimeMillis()); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4062Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4062Test.java index 222efc7a84..2be0126b27 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4062Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4062Test.java @@ -23,6 +23,7 @@ import java.io.IOException; import java.lang.reflect.Field; import java.util.Iterator; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; import java.util.concurrent.CountDownLatch; import javax.jms.DeliveryMode; @@ -57,7 +58,7 @@ public class AMQ4062Test { private BrokerService service; private PolicyEntry policy; - private ConcurrentHashMap durableSubscriptions; + private ConcurrentMap durableSubscriptions; private static final int PREFETCH_SIZE_5=5; private String connectionUri; @@ -174,17 +175,17 @@ public class AMQ4062Test { } @SuppressWarnings("unchecked") - private ConcurrentHashMap getDurableSubscriptions() throws NoSuchFieldException, IllegalAccessException { + private ConcurrentMap getDurableSubscriptions() throws NoSuchFieldException, IllegalAccessException { if(durableSubscriptions!=null) return durableSubscriptions; RegionBroker regionBroker=(RegionBroker)service.getRegionBroker(); TopicRegion region=(TopicRegion)regionBroker.getTopicRegion(); Field field=TopicRegion.class.getDeclaredField("durableSubscriptions"); field.setAccessible(true); - durableSubscriptions=(ConcurrentHashMap)field.get(region); + durableSubscriptions=(ConcurrentMap)field.get(region); return durableSubscriptions; } - private ConsumerInfo getConsumerInfo(ConcurrentHashMap durableSubscriptions) { + private ConsumerInfo getConsumerInfo(ConcurrentMap durableSubscriptions) { ConsumerInfo info=null; for(Iterator it=durableSubscriptions.values().iterator();it.hasNext();){ Subscription sub = it.next(); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/tcp/SocketTstFactory.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/tcp/SocketTstFactory.java index 396f284785..9b31a7348c 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/tcp/SocketTstFactory.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/tcp/SocketTstFactory.java @@ -22,6 +22,7 @@ import java.net.Socket; import java.net.UnknownHostException; import java.util.Random; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; import javax.net.SocketFactory; @@ -36,7 +37,7 @@ import org.slf4j.LoggerFactory; public class SocketTstFactory extends SocketFactory { private static final Logger LOG = LoggerFactory.getLogger(SocketTstFactory.class); - private static final ConcurrentHashMap closeIter = new ConcurrentHashMap(); + private static final ConcurrentMap closeIter = new ConcurrentHashMap(); private class SocketTst {