ARTEMIS-153 Improving reconnection log.debug

https://issues.apache.org/jira/browse/ARTEMIS-153

This is bringing some small changes recent made on the legacy implementation
This commit is contained in:
Clebert Suconic 2015-07-06 12:26:39 -04:00
parent 24979a771d
commit 45ac13008f
4 changed files with 23 additions and 10 deletions

View File

@ -418,4 +418,23 @@ public interface ActiveMQClientLogger extends BasicLogger
@LogMessage(level = Logger.Level.ERROR)
@Message(id = 214025, value = "Invalid type {0}, Using default connection factory at {1}", format = Message.Format.MESSAGE_FORMAT)
void invalidCFType(String type, String uri);
@LogMessage(level = Logger.Level.TRACE)
@Message(id = 214026,
value = "Failure captured on connectionID={0}, performing failover or reconnection now",
format = Message.Format.MESSAGE_FORMAT)
void failoverOrReconnect(Object connectionID, @Cause Throwable cause);
@LogMessage(level = Logger.Level.DEBUG)
@Message(id = 214027,
value = "Replaying commands for channelID={0} with lastCommandID from the server={1}",
format = Message.Format.MESSAGE_FORMAT)
void replayingCommands(Object connectionID, int lastConfirmedCommandID);
@LogMessage(level = Logger.Level.DEBUG)
@Message(id = 214028,
value = "Couldn't reattach session {0}, performing as a failover operation now and recreating objects",
format = Message.Format.MESSAGE_FORMAT)
void reconnectCreatingNewSession(long id);
}

View File

@ -580,6 +580,8 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
*/
private void failoverOrReconnect(final Object connectionID, final ActiveMQException me, String scaleDownTargetNodeID)
{
ActiveMQClientLogger.LOGGER.failoverOrReconnect(connectionID, me);
Set<ClientSessionInternal> sessionsToClose = null;
if (!clientProtocolManager.isAlive())
return;

View File

@ -975,12 +975,6 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
if (!reattached)
{
if (ActiveMQClientLogger.LOGGER.isDebugEnabled())
{
ActiveMQClientLogger.LOGGER.debug("ClientSession couldn't be reattached, creating a new session");
}
for (ClientConsumerInternal consumer : cloneConsumers())
{
consumer.clearAtFailover();

View File

@ -594,10 +594,7 @@ public class ActiveMQSessionContext extends SessionContext
if (response.isReattached())
{
if (ActiveMQClientLogger.LOGGER.isDebugEnabled())
{
ActiveMQClientLogger.LOGGER.debug("ClientSession reattached fine, replaying commands");
}
ActiveMQClientLogger.LOGGER.replayingCommands(sessionChannel.getID(), response.getLastConfirmedCommandID());
// The session was found on the server - we reattached transparently ok
sessionChannel.replayCommands(response.getLastConfirmedCommandID());
@ -606,6 +603,7 @@ public class ActiveMQSessionContext extends SessionContext
}
else
{
ActiveMQClientLogger.LOGGER.reconnectCreatingNewSession(sessionChannel.getID());
sessionChannel.clearCommands();