This commit is contained in:
Clebert Suconic 2018-06-12 18:54:45 -04:00
commit 83d363de62
2 changed files with 7 additions and 11 deletions

View File

@ -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) {

View File

@ -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