Source:
public boolean handleFailover(final RemotingConnection backupConnection, ActiveMQException cause) { boolean failed = false; synchronized (this) { if (closed) { return false; } boolean resetCreditManager = false; try { boolean reattached = sessionContext.reattachOnNewConnection(backupConnection); if (!reattached) { this.name = UUIDGenerator.getInstance().generateStringUUID(); sessionContext.resetName(name); for (ClientConsumerInternal consumer : cloneConsumers()) { consumer.clearAtFailover(); } if (!inClose && mayAttemptToFailover) { sessionContext.recreateSession(username, password, minLargeMessageSize, xa, autoCommitSends, autoCommitAcks, preAcknowledge); for (Map.Entry<ConsumerContext, ClientConsumerInternal> entryx : consumers.entrySet()) { ClientConsumerInternal consumerInternal = entryx.getValue(); sessionContext.recreateConsumerOnServer(consumerInternal, entryx.getKey().getId(), started); } if ((!autoCommitAcks || !autoCommitSends) && workDone) { rollbackOnly = true; } if (currentXID != null) { sessionContext.xaFailed(currentXID); rollbackOnly = true; } if (started) { for (ClientConsumerInternal consumer : cloneConsumers()) { consumer.clearAtFailover(); consumer.start(); } sessionContext.restartSession(); } resetCreditManager = true; } sessionContext.returnBlocking(cause); } } catch (Throwable t) { ActiveMQClientLogger.LOGGER.failedToHandleFailover(t); failed = true; } finally { sessionContext.releaseCommunications(); } if (resetCreditManager) { synchronized (producerCreditManager) { producerCreditManager.reset(); } } } HashMap<String, String> metaDataToSend; synchronized (metadata) { metaDataToSend = new HashMap<>(metadata); } sessionContext.resetMetadata(metaDataToSend); return failed; }

Target:
public boolean handleFailover(final RemotingConnection backupConnection, ActiveMQException cause) { boolean suc = true; synchronized (this) { if (closed) { return true; } boolean resetCreditManager = false; try { boolean reattached = sessionContext.reattachOnNewConnection(backupConnection); if (!reattached) { this.name = UUIDGenerator.getInstance().generateStringUUID(); sessionContext.resetName(name); for (ClientConsumerInternal consumer : cloneConsumers()) { consumer.clearAtFailover(); } if (!inClose && mayAttemptToFailover) { sessionContext.recreateSession(username, password, minLargeMessageSize, xa, autoCommitSends, autoCommitAcks, preAcknowledge); for (Map.Entry<ConsumerContext, ClientConsumerInternal> entryx : consumers.entrySet()) { ClientConsumerInternal consumerInternal = entryx.getValue(); sessionContext.recreateConsumerOnServer(consumerInternal, entryx.getKey().getId(), started); } if ((!autoCommitAcks || !autoCommitSends) && workDone) { rollbackOnly = true; } if (currentXID != null) { sessionContext.xaFailed(currentXID); rollbackOnly = true; } if (started) { for (ClientConsumerInternal consumer : cloneConsumers()) { consumer.clearAtFailover(); consumer.start(); } sessionContext.restartSession(); } resetCreditManager = true; } sessionContext.returnBlocking(cause); } } catch (Throwable t) { ActiveMQClientLogger.LOGGER.failedToHandleFailover(t); suc = false; } finally { sessionContext.releaseCommunications(); } if (resetCreditManager) { synchronized (producerCreditManager) { producerCreditManager.reset(); } } } HashMap<String, String> metaDataToSend; synchronized (metadata) { metaDataToSend = new HashMap<>(metadata); } sessionContext.resetMetadata(metaDataToSend); return suc; }