@Override protected void onStateChanged() { boolean isLeader = isLeader(); boolean hasLeader = hasLeader(); changeSupport.onLeadershipChange(isLeader, hasLeader); treeChangeSupport.onLeadershipChange(isLeader, hasLeader); // If this actor is no longer the leader close all the transaction chains if (!isLeader) { if (LOG.isDebugEnabled()) { LOG.debug( "{}: onStateChanged: Closing all transaction chains because shard {} is no longer the leader", persistenceId(), getId()); } store.closeAllTransactionChains(); commitCoordinator.abortPendingTransactions( "The transacton was aborted due to inflight leadership change.", this); } if (hasLeader && !isIsolatedLeader()) { messageRetrySupport.retryMessages(); } }
@Override protected void onLeaderChanged(String oldLeader, String newLeader) { shardMBean.incrementLeadershipChangeCount(); if (hasLeader() && !isIsolatedLeader()) { messageRetrySupport.retryMessages(); } }