diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/ActiveMQChannelHandler.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/ActiveMQChannelHandler.java index d0d5c0e992..de8b49ef56 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/ActiveMQChannelHandler.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/ActiveMQChannelHandler.java @@ -26,7 +26,6 @@ import io.netty.channel.group.ChannelGroup; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.core.buffers.impl.ChannelBufferWrapper; import org.apache.activemq.artemis.core.client.ActiveMQClientLogger; -import org.apache.activemq.artemis.core.client.ActiveMQClientMessageBundle; import org.apache.activemq.artemis.spi.core.remoting.BaseConnectionLifeCycleListener; import org.apache.activemq.artemis.spi.core.remoting.BufferHandler; @@ -99,7 +98,7 @@ public class ActiveMQChannelHandler extends ChannelDuplexHandler { // and we don't want to spew out stack traces in that event // The user has access to this exeception anyway via the ActiveMQException initial cause - ActiveMQException me = ActiveMQClientMessageBundle.BUNDLE.nettyError(); + ActiveMQException me = new ActiveMQException(cause.getMessage()); me.initCause(cause); synchronized (listener) { 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 17351d9af8..5a1ddefae3 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 @@ -539,6 +539,10 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif logger.trace("Connection removed " + connectionID + " from server " + this.server, new Exception("trace")); } + issueFailure(connectionID, new ActiveMQRemoteDisconnectException()); + } + + private void issueFailure(Object connectionID, ActiveMQException e) { ConnectionEntry conn = connections.get(connectionID); if (conn != null && !conn.connection.isSupportReconnect()) { @@ -554,20 +558,13 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif return; } } - conn.connection.fail(new ActiveMQRemoteDisconnectException()); + conn.connection.fail(e); } } @Override public void connectionException(final Object connectionID, final ActiveMQException me) { - // We DO NOT call fail on connection exception, otherwise in event of real connection failure, the - // connection will be failed, the session will be closed and won't be able to reconnect - - // E.g. if live server fails, then this handler wil be called on backup server for the server - // side replicating connection. - // If the connection fail() is called then the sessions on the backup will get closed. - - // Connections should only fail when TTL is exceeded + issueFailure(connectionID, me); } @Override