@Override
protected void processFuture ()
throws ExecutionException, InterruptedException {
MessageExchange me = f.get();
if (me.getResponseMessage() == null) {
LoggerUtils.logMsg(logger, elections.getRepImpl(),
formatter, Level.FINE,
"No response from: " + me.target +
" reason: " + me.exception);
return;
}
if (me.getResponseMessage().getOp() ==
elections.getProtocol().REJECT) {
/*
* The acceptor has already received a higher numbered
* Prepare request. Abandon this round as an
* optimization.
*/
Utils.discardFutures
(futures.subList(futures.indexOf(f),
futures.size()));
phase1HigherProposal.increment();
throw new HigherNumberedProposal(me.target);
} else if (me.getResponseMessage().getOp() ==
elections.getProtocol().PROMISE) {
result.promisories.add(me.target);
result.promisoryMessages.add(me);
Promise accept = (Promise) me.getResponseMessage();
Proposal acceptProposal = accept.getHighestProposal();
if ((result.acceptProposal == null) ||
((acceptProposal != null) &&
(acceptProposal.compareTo(result.acceptProposal) >
0))) {
result.acceptProposal = acceptProposal;
result.acceptedValue = accept.getAcceptedValue();
}
} else if (me.getResponseMessage().getOp() ==
elections.getProtocol().PROTOCOL_ERROR){
ProtocolError protocolError =
(ProtocolError) me.getResponseMessage();
/* Possible protocol version, group, or config skew. */
LoggerUtils.logMsg(logger, elections.getRepImpl(),
formatter, Level.WARNING,
"Election protocol error: " +
protocolError.getMessage());
return;
} else {
throw EnvironmentFailureException.unexpectedState
("Unknown response: " +
me.getResponseMessage().getOp());
}
}
}.execute(logger, elections.getRepImpl(), null);
}