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%2FShardDataTreeTransactionChain.java;h=7917ae0177f6a9f737cd59b04d314e67b841c95e;hp=9406eab6b98ebd03f13898bb5b123850fe334343;hb=546cd1fd100dbaa36908b22c2f422320dbd8c4b2;hpb=62cddd88e42e8f3c6a92bbf42c97b0d6806f44ae diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTreeTransactionChain.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTreeTransactionChain.java index 9406eab6b9..7917ae0177 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTreeTransactionChain.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTreeTransactionChain.java @@ -7,8 +7,10 @@ */ package org.opendaylight.controller.cluster.datastore; +import static com.google.common.base.Preconditions.checkState; +import static java.util.Objects.requireNonNull; + import com.google.common.base.MoreObjects; -import com.google.common.base.Preconditions; import java.util.Optional; import java.util.SortedSet; import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier; @@ -34,13 +36,13 @@ final class ShardDataTreeTransactionChain extends ShardDataTreeTransactionParent private boolean closed; ShardDataTreeTransactionChain(final LocalHistoryIdentifier localHistoryIdentifier, final ShardDataTree dataTree) { - this.chainId = Preconditions.checkNotNull(localHistoryIdentifier); - this.dataTree = Preconditions.checkNotNull(dataTree); + this.chainId = requireNonNull(localHistoryIdentifier); + this.dataTree = requireNonNull(dataTree); } private DataTreeSnapshot getSnapshot() { - Preconditions.checkState(!closed, "TransactionChain %s has been closed", this); - Preconditions.checkState(openTransaction == null, "Transaction %s is open", openTransaction); + checkState(!closed, "TransactionChain %s has been closed", this); + checkState(openTransaction == null, "Transaction %s is open", openTransaction); if (previousTx == null) { LOG.debug("Opening an unchained snapshot in {}", chainId); @@ -74,8 +76,8 @@ final class ShardDataTreeTransactionChain extends ShardDataTreeTransactionParent @Override void abortFromTransactionActor(final AbstractShardDataTreeTransaction transaction) { if (transaction instanceof ReadWriteShardDataTreeTransaction) { - Preconditions.checkState(openTransaction != null, - "Attempted to abort transaction %s while none is outstanding", transaction); + checkState(openTransaction != null, "Attempted to abort transaction %s while none is outstanding", + transaction); LOG.debug("Aborted open transaction {}", transaction); openTransaction = null; } @@ -90,8 +92,8 @@ final class ShardDataTreeTransactionChain extends ShardDataTreeTransactionParent @Override ShardDataTreeCohort finishTransaction(final ReadWriteShardDataTreeTransaction transaction, final Optional> participatingShardNames) { - Preconditions.checkState(openTransaction != null, - "Attempted to finish transaction %s while none is outstanding", transaction); + checkState(openTransaction != null, "Attempted to finish transaction %s while none is outstanding", + transaction); // dataTree is finalizing ready the transaction, we just record it for the next // transaction in chain