Search in sources :

Example 16 with LocalHistoryIdentifier

use of org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier in project controller by opendaylight.

the class BouncingReconnectForwarder method findCohort.

private ProxyReconnectCohort findCohort(final ConnectionEntry entry) throws CohortNotFoundException {
    final Request<?, ?> request = entry.getRequest();
    final LocalHistoryIdentifier historyId;
    if (request instanceof TransactionRequest) {
        historyId = ((TransactionRequest<?>) request).getTarget().getHistoryId();
    } else if (request instanceof LocalHistoryRequest) {
        historyId = ((LocalHistoryRequest<?>) request).getTarget();
    } else {
        throw new IllegalArgumentException("Unhandled request " + request);
    }
    final ProxyReconnectCohort cohort = cohorts.get(historyId);
    if (cohort == null) {
        LOG.warn("Cohort for request {} not found, aborting it", request);
        throw new CohortNotFoundException(historyId);
    }
    return cohort;
}
Also used : LocalHistoryRequest(org.opendaylight.controller.cluster.access.commands.LocalHistoryRequest) LocalHistoryIdentifier(org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier) TransactionRequest(org.opendaylight.controller.cluster.access.commands.TransactionRequest)

Aggregations

LocalHistoryIdentifier (org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier)16 TransactionIdentifier (org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier)5 Test (org.junit.Test)4 LocalHistorySuccess (org.opendaylight.controller.cluster.access.commands.LocalHistorySuccess)3 Response (org.opendaylight.controller.cluster.access.concepts.Response)3 DeadHistoryException (org.opendaylight.controller.cluster.access.commands.DeadHistoryException)2 TransactionAbortSuccess (org.opendaylight.controller.cluster.access.commands.TransactionAbortSuccess)2 ClientIdentifier (org.opendaylight.controller.cluster.access.concepts.ClientIdentifier)2 FrontendIdentifier (org.opendaylight.controller.cluster.access.concepts.FrontendIdentifier)2 SuccessEnvelope (org.opendaylight.controller.cluster.access.concepts.SuccessEnvelope)2 ActorRef (akka.actor.ActorRef)1 HashMap (java.util.HashMap)1 Nonnull (javax.annotation.Nonnull)1 Nullable (javax.annotation.Nullable)1 GuardedBy (javax.annotation.concurrent.GuardedBy)1 Before (org.junit.Before)1 CreateLocalHistoryRequest (org.opendaylight.controller.cluster.access.commands.CreateLocalHistoryRequest)1 LocalHistoryRequest (org.opendaylight.controller.cluster.access.commands.LocalHistoryRequest)1 ModifyTransactionRequestBuilder (org.opendaylight.controller.cluster.access.commands.ModifyTransactionRequestBuilder)1 TransactionRequest (org.opendaylight.controller.cluster.access.commands.TransactionRequest)1