From e762f823d19fe569e4df6bd0713732223faa5fb4 Mon Sep 17 00:00:00 2001 From: jbertram Date: Tue, 9 Feb 2016 13:42:12 -0600 Subject: [PATCH] ARTEMIS-391 log WARN on cxn limit --- .../artemis/core/remoting/impl/netty/NettyAcceptor.java | 7 +++---- .../activemq/artemis/core/server/ActiveMQServerLogger.java | 4 ++++ 2 files changed, 7 insertions(+), 4 deletions(-) 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 a5067c612a..8a0dc2feb6 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 @@ -642,10 +642,9 @@ public class NettyAcceptor extends AbstractAcceptor { return nc; } else { - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug(new StringBuilder().append("Connection limit of ").append(connectionsAllowed).append(" reached. Refusing connection from ").append(ctx.channel().remoteAddress())); - } - throw new Exception(); + ActiveMQServerLogger.LOGGER.connectionLimitReached(connectionsAllowed, ctx.channel().remoteAddress().toString()); + ctx.channel().close(); + return null; } } } 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 f7038fb9e9..aca3c3fb15 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 @@ -1204,6 +1204,10 @@ public interface ActiveMQServerLogger extends BasicLogger { @Message(id = 222205, value = "OutOfMemoryError possible! There are currently {0} addresses with a total max-size-bytes of {1} bytes, but the maximum memory available is {2} bytes.", format = Message.Format.MESSAGE_FORMAT) void potentialOOME(long addressCount, long totalMaxSizeBytes, long maxMemory); + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222206, value = "Connection limit of {0} reached. Refusing connection from {1}.", format = Message.Format.MESSAGE_FORMAT) + void connectionLimitReached(long connectionsAllowed, String address); + @LogMessage(level = Logger.Level.ERROR) @Message(id = 224000, value = "Failure in initialisation", format = Message.Format.MESSAGE_FORMAT) void initializationError(@Cause Throwable e);