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%2FLocalTransactionFactoryImpl.java;h=a4b2e4e62cb4d980b2d6e4a3352155c4627ede92;hp=2f4474b5d7350071b90244e2297f3917d7fbe180;hb=7292faba613ab556babd7bbcdd78984f5668bf9b;hpb=340a2d4c979ac6f8d5adff8bd9e1c9f724e7a164 diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/LocalTransactionFactoryImpl.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/LocalTransactionFactoryImpl.java index 2f4474b5d7..a4b2e4e62c 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/LocalTransactionFactoryImpl.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/LocalTransactionFactoryImpl.java @@ -9,7 +9,9 @@ package org.opendaylight.controller.cluster.datastore; import akka.actor.ActorSelection; import com.google.common.base.Preconditions; -import org.opendaylight.controller.cluster.datastore.identifiers.TransactionIdentifier; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier; import org.opendaylight.controller.cluster.datastore.utils.ActorContext; import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction; import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction; @@ -64,21 +66,23 @@ final class LocalTransactionFactoryImpl extends TransactionReadyPrototype tx, - final DataTreeModification tree) { - return new LocalThreePhaseCommitCohort(actorContext, leader, tx, tree); + protected DOMStoreThreePhaseCommitCohort transactionReady( + final SnapshotBackedWriteTransaction tx, + final DataTreeModification tree, + final Exception readyError) { + return new LocalThreePhaseCommitCohort(actorContext, leader, tx, tree, readyError); } - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked", "checkstyle:IllegalCatch"}) @Override - public LocalThreePhaseCommitCohort onTransactionReady(DOMStoreWriteTransaction tx) { - try { - return (LocalThreePhaseCommitCohort) tx.ready(); - } catch (Exception e) { - // Unfortunately we need to cast to SnapshotBackedWriteTransaction here as it's required by - // LocalThreePhaseCommitCohort. + public LocalThreePhaseCommitCohort onTransactionReady(@Nonnull DOMStoreWriteTransaction tx, + @Nullable Exception operationError) { + Preconditions.checkArgument(tx instanceof SnapshotBackedWriteTransaction); + if (operationError != null) { return new LocalThreePhaseCommitCohort(actorContext, leader, - (SnapshotBackedWriteTransaction)tx, e); + (SnapshotBackedWriteTransaction)tx, operationError); } + + return (LocalThreePhaseCommitCohort) tx.ready(); } }