From 4eb669f035cf3632b2dd2eb0f6d799e48e72adea Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Wed, 7 Oct 2015 22:07:05 -0400 Subject: [PATCH] ARTEMIS-151 avoiding duplicate config of acceptors --- .../core/remoting/server/impl/RemotingServiceImpl.java | 8 ++++++++ .../artemis/core/server/ActiveMQServerLogger.java | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java index ab9de61f52..7d3901989f 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java @@ -206,7 +206,15 @@ public class RemotingServiceImpl implements RemotingService, ConnectionLifeCycle threadPool = Executors.newCachedThreadPool(tFactory); + HashSet namelessAcceptors = new HashSet<>(); + for (TransportConfiguration info : acceptorsConfig) { + TransportConfiguration nameless = info.newTransportConfig(""); + if (namelessAcceptors.contains(nameless)) { + ActiveMQServerLogger.LOGGER.duplicatedAcceptor(info.getName(), "" + info.getParams(), info.getFactoryClassName()); + continue; + } + namelessAcceptors.add(nameless); try { AcceptorFactory factory = server.getServiceRegistry().getAcceptorFactory(info.getName(), info.getFactoryClassName()); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java index f2d42844bc..5c4dc66279 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java @@ -1441,4 +1441,8 @@ public interface ActiveMQServerLogger extends BasicLogger { @Message(id = 224065, value = "Failed to remove auto-created queue {0}", format = Message.Format.MESSAGE_FORMAT) void errorRemovingAutoCreatedQueue(@Cause Exception e, SimpleString bindingName); + @LogMessage(level = Logger.Level.WARN) + @Message(id = 224066, value = "Duplicated Acceptor {0} with parameters {1} classFactory={2} duplicated on the configuration", format = Message.Format.MESSAGE_FORMAT) + void duplicatedAcceptor(String name, String parameters, String classFactory); + }