X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FDataTreeCohortActor.java;h=e6ff10d8315cd47da347ae4764d20c7b825b51eb;hp=10ffe1f7b7dd40793820caa078b58be7855a65e1;hb=013a6679470bf692753f2e04ab4398c97fd9f5d0;hpb=4d1709660b7af992d4c382a2a38debb5c7d64fb9 diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeCohortActor.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeCohortActor.java index 10ffe1f7b7..e6ff10d831 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeCohortActor.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeCohortActor.java @@ -19,22 +19,22 @@ import org.opendaylight.mdsal.common.api.PostPreCommitStep; import org.opendaylight.mdsal.common.api.ThreePhaseCommitStep; import org.opendaylight.mdsal.dom.api.DOMDataTreeCandidate; import org.opendaylight.mdsal.dom.api.DOMDataTreeCommitCohort; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.model.api.SchemaContext; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * Proxy actor which acts as a facade to the user-provided commit cohort. Responsible for * decapsulating DataTreeChanged messages and dispatching their context to the user. */ final class DataTreeCohortActor extends AbstractUntypedActor { - private static final Logger LOG = LoggerFactory.getLogger(DataTreeCohortActor.class); private final CohortBehaviour idleState = new Idle(); private final DOMDataTreeCommitCohort cohort; + private final YangInstanceIdentifier registeredPath; private CohortBehaviour currentState = idleState; - private DataTreeCohortActor(final DOMDataTreeCommitCohort cohort) { + private DataTreeCohortActor(final DOMDataTreeCommitCohort cohort, final YangInstanceIdentifier registeredPath) { this.cohort = Preconditions.checkNotNull(cohort); + this.registeredPath = Preconditions.checkNotNull(registeredPath); } @Override @@ -48,7 +48,7 @@ final class DataTreeCohortActor extends AbstractUntypedActor { * * @param Reply message type */ - static abstract class CommitProtocolCommand { + abstract static class CommitProtocolCommand { private final TransactionIdentifier txId; @@ -88,7 +88,7 @@ final class DataTreeCohortActor extends AbstractUntypedActor { } - static abstract class CommitReply { + abstract static class CommitReply { private final ActorRef cohortRef; private final TransactionIdentifier txId; @@ -109,7 +109,7 @@ final class DataTreeCohortActor extends AbstractUntypedActor { static final class Success extends CommitReply { - public Success(ActorRef cohortRef, TransactionIdentifier txId) { + Success(ActorRef cohortRef, TransactionIdentifier txId) { super(cohortRef, txId); } @@ -117,26 +117,26 @@ final class DataTreeCohortActor extends AbstractUntypedActor { static final class PreCommit extends CommitProtocolCommand { - public PreCommit(TransactionIdentifier txId) { + PreCommit(TransactionIdentifier txId) { super(txId); } } static final class Abort extends CommitProtocolCommand { - public Abort(TransactionIdentifier txId) { + Abort(TransactionIdentifier txId) { super(txId); } } static final class Commit extends CommitProtocolCommand { - public Commit(TransactionIdentifier txId) { + Commit(TransactionIdentifier txId) { super(txId); } } - private static abstract class CohortBehaviour { + private abstract static class CohortBehaviour { abstract Class getHandledMessageType(); @@ -146,7 +146,8 @@ final class DataTreeCohortActor extends AbstractUntypedActor { } else if (message instanceof Abort) { return abort(); } - throw new UnsupportedOperationException(); + throw new UnsupportedOperationException(String.format("Unexpected message %s in cohort behavior %s", + message.getClass(), getClass().getSimpleName())); } abstract CohortBehaviour abort(); @@ -163,6 +164,7 @@ final class DataTreeCohortActor extends AbstractUntypedActor { } @Override + @SuppressWarnings("checkstyle:IllegalCatch") CohortBehaviour process(CanCommit message) { final PostCanCommitStep nextStep; try { @@ -203,6 +205,7 @@ final class DataTreeCohortActor extends AbstractUntypedActor { } @Override + @SuppressWarnings("checkstyle:IllegalCatch") final CohortBehaviour abort() { try { getStep().abort().get(); @@ -229,6 +232,7 @@ final class DataTreeCohortActor extends AbstractUntypedActor { } @Override + @SuppressWarnings("checkstyle:IllegalCatch") CohortBehaviour process(PreCommit message) { final PostPreCommitStep nextStep; try { @@ -250,6 +254,7 @@ final class DataTreeCohortActor extends AbstractUntypedActor { } @Override + @SuppressWarnings("checkstyle:IllegalCatch") CohortBehaviour process(Commit message) { try { getStep().commit().get(); @@ -268,7 +273,7 @@ final class DataTreeCohortActor extends AbstractUntypedActor { } - static Props props(final DOMDataTreeCommitCohort cohort) { - return Props.create(DataTreeCohortActor.class, cohort); + static Props props(final DOMDataTreeCommitCohort cohort, final YangInstanceIdentifier registeredPath) { + return Props.create(DataTreeCohortActor.class, cohort, registeredPath); } }