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%2Fdatabroker%2Factors%2Fdds%2FAbstractProxyTransaction.java;h=cc1651a2edcf33a6ba4779b7bd37038a99db5ea0;hp=8ff8b8eff9cb5850d1c7a8bf5c39e408627355a4;hb=refs%2Fchanges%2F99%2F47499%2F3;hpb=314d5b41ea6b464db939da95a33c872f594ccada diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/AbstractProxyTransaction.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/AbstractProxyTransaction.java index 8ff8b8eff9..cc1651a2ed 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/AbstractProxyTransaction.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/AbstractProxyTransaction.java @@ -34,9 +34,11 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; /** * Class translating transaction operations towards a particular backend shard. * + *

* This class is not safe to access from multiple application threads, as is usual for transactions. Internal state * transitions coming from interactions with backend are expected to be thread-safe. * + *

* This class interacts with the queueing mechanism in ClientActorBehavior, hence once we arrive at a decision * to use either a local or remote implementation, we are stuck with it. We can re-evaluate on the next transaction. * @@ -90,7 +92,7 @@ abstract class AbstractProxyTransaction implements Identifiable ret) { + checkSealed(); + + sendRequest(new TransactionAbortRequest(getIdentifier(), nextSequence(), localActor()), t -> { + if (t instanceof TransactionAbortSuccess) { + ret.voteYes(); + } else if (t instanceof RequestFailure) { + ret.voteNo(((RequestFailure) t).getCause()); + } else { + ret.voteNo(new IllegalStateException("Unhandled response " + t.getClass())); + } + }); + } + /** * Commit this transaction, possibly in a coordinated fashion. * @@ -133,20 +149,6 @@ abstract class AbstractProxyTransaction implements Identifiable ret) { - checkSealed(); - - sendRequest(new TransactionAbortRequest(getIdentifier(), nextSequence(), localActor()), t -> { - if (t instanceof TransactionAbortSuccess) { - ret.voteYes(); - } else if (t instanceof RequestFailure) { - ret.voteNo(((RequestFailure) t).getCause()); - } else { - ret.voteNo(new IllegalStateException("Unhandled response " + t.getClass())); - } - }); - } - void canCommit(final VotingFuture ret) { checkSealed(); @@ -164,7 +166,7 @@ abstract class AbstractProxyTransaction implements Identifiable ret) { checkSealed(); - sendRequest(new TransactionPreCommitRequest(getIdentifier(), nextSequence(), localActor()), t-> { + sendRequest(new TransactionPreCommitRequest(getIdentifier(), nextSequence(), localActor()), t -> { if (t instanceof TransactionPreCommitSuccess) { ret.voteYes(); } else if (t instanceof RequestFailure) { @@ -178,7 +180,7 @@ abstract class AbstractProxyTransaction implements Identifiable ret) { checkSealed(); - sendRequest(new TransactionDoCommitRequest(getIdentifier(), nextSequence(), localActor()), t-> { + sendRequest(new TransactionDoCommitRequest(getIdentifier(), nextSequence(), localActor()), t -> { if (t instanceof TransactionCommitSuccess) { ret.voteYes(); } else if (t instanceof RequestFailure) { @@ -189,6 +191,8 @@ abstract class AbstractProxyTransaction implements Identifiable doCommit(boolean coordinated); + abstract void doDelete(final YangInstanceIdentifier path); abstract void doMerge(final YangInstanceIdentifier path, final NormalizedNode data); @@ -197,11 +201,10 @@ abstract class AbstractProxyTransaction implements Identifiable doExists(final YangInstanceIdentifier path); - abstract CheckedFuture>, ReadFailedException> doRead(final YangInstanceIdentifier path); + abstract CheckedFuture>, ReadFailedException> doRead( + final YangInstanceIdentifier path); abstract void doSeal(); abstract void doAbort(); - - abstract TransactionRequest doCommit(boolean coordinated); }