Search in sources :

Example 1 with UnknownHistoryException

use of org.opendaylight.controller.cluster.access.commands.UnknownHistoryException in project controller by opendaylight.

the class LeaderFrontendState method handleTransactionRequest.

@Nullable
TransactionSuccess<?> handleTransactionRequest(final TransactionRequest<?> request, final RequestEnvelope envelope, final long now) throws RequestException {
    checkRequestSequence(envelope);
    try {
        final LocalHistoryIdentifier lhId = request.getTarget().getHistoryId();
        final AbstractFrontendHistory history;
        if (lhId.getHistoryId() != 0) {
            history = localHistories.get(lhId);
            if (history == null) {
                if (purgedHistories.contains(lhId.getHistoryId())) {
                    LOG.warn("{}: rejecting request {} to purged history", persistenceId, request);
                    throw new DeadHistoryException(purgedHistories.toImmutable());
                }
                LOG.warn("{}: rejecting unknown history request {}", persistenceId, request);
                throw new UnknownHistoryException(lastSeenHistory);
            }
        } else {
            history = standaloneHistory;
        }
        return history.handleTransactionRequest(request, envelope, now);
    } finally {
        expectNextRequest();
    }
}
Also used : UnknownHistoryException(org.opendaylight.controller.cluster.access.commands.UnknownHistoryException) DeadHistoryException(org.opendaylight.controller.cluster.access.commands.DeadHistoryException) LocalHistoryIdentifier(org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier) Nullable(javax.annotation.Nullable)

Aggregations

Nullable (javax.annotation.Nullable)1 DeadHistoryException (org.opendaylight.controller.cluster.access.commands.DeadHistoryException)1 UnknownHistoryException (org.opendaylight.controller.cluster.access.commands.UnknownHistoryException)1 LocalHistoryIdentifier (org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier)1