Collection<TransactionContext> setNotLeaderException(NotLeaderException nle) { LOG.debug("{}: PendingRequests.setNotLeaderException", name); try { return map.values().stream() .map(p -> p.setNotLeaderException(nle)) .collect(Collectors.toList()); } finally { map.clear(); } } }
Collection<TransactionContext> setNotLeaderException(NotLeaderException nle, Collection<CommitInfoProto> commitInfos) { LOG.debug("{}: PendingRequests.setNotLeaderException", name); try { return map.values().stream() .map(p -> p.setNotLeaderException(nle, commitInfos)) .collect(Collectors.toList()); } finally { map.clear(); } } }
/** * The leader state is stopped. Send NotLeaderException to all the pending * requests since they have not got applied to the state machine yet. */ Collection<TransactionContext> sendNotLeaderResponses(NotLeaderException nle, Collection<CommitInfoProto> commitInfos) { LOG.info("{}: sendNotLeaderResponses", name); final Collection<TransactionContext> transactions = pendingRequests.setNotLeaderException(nle, commitInfos); if (pendingSetConf != null) { pendingSetConf.setNotLeaderException(nle, commitInfos); } return transactions; } }
/** * The leader state is stopped. Send NotLeaderException to all the pending * requests since they have not got applied to the state machine yet. */ void sendNotLeaderResponses() throws IOException { LOG.info("{} sends responses before shutting down PendingRequestsHandler", server.getId()); // notify the state machine about stepping down final NotLeaderException nle = server.generateNotLeaderException(); server.getStateMachine().notifyNotLeader(pendingRequests.setNotLeaderException(nle)); if (pendingSetConf != null) { pendingSetConf.setNotLeaderException(nle); } delayedReplies.failReplies(); }