use of org.opendaylight.controller.cluster.access.commands.IncrementTransactionSequenceSuccess in project controller by opendaylight.
the class FrontendTransaction method handleRequest.
// Request order has already been checked by caller and replaySequence()
@SuppressWarnings("checkstyle:IllegalCatch")
@Nullable
final TransactionSuccess<?> handleRequest(final TransactionRequest<?> request, final RequestEnvelope envelope, final long now) throws RequestException {
if (request instanceof IncrementTransactionSequenceRequest) {
final IncrementTransactionSequenceRequest incr = (IncrementTransactionSequenceRequest) request;
expectedSequence += incr.getIncrement();
return recordSuccess(incr.getSequence(), new IncrementTransactionSequenceSuccess(incr.getTarget(), incr.getSequence()));
}
if (previousFailure != null) {
LOG.debug("{}: Rejecting request {} due to previous failure", persistenceId(), request, previousFailure);
throw previousFailure;
}
try {
return doHandleRequest(request, envelope, now);
} catch (RuntimeException e) {
/*
* The request failed to process, we should not attempt to ever
* apply it again. Furthermore we cannot accept any further requests
* from this connection, simply because the transaction state is
* undefined.
*/
LOG.debug("{}: Request {} failed to process", persistenceId(), request, e);
previousFailure = new RuntimeRequestException("Request " + request + " failed to process", e);
throw previousFailure;
}
}
Aggregations