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%2FTransactionProxy.java;h=155bb1fd3e303cfe8aa929fb44322bad90e2e949;hp=83863de00dd7dbfeebe96235a874da057bfd4a52;hb=3859df9beca8f13f1ff2b2744ed3470a1715bec3;hpb=083a04543a96ae862c48ccb4aaefc667f19d9f1e diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java index 83863de00d..155bb1fd3e 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java @@ -7,10 +7,12 @@ */ package org.opendaylight.controller.cluster.datastore; +import static com.google.common.base.Preconditions.checkState; +import static java.util.Objects.requireNonNull; + import akka.actor.ActorSelection; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Function; -import com.google.common.base.Preconditions; import com.google.common.base.Supplier; import com.google.common.collect.Iterables; import com.google.common.util.concurrent.FluentFuture; @@ -71,7 +73,7 @@ public class TransactionProxy extends AbstractDOMStoreTransaction FluentFuture executeRead(final String shardName, final AbstractRead readCmd) { - Preconditions.checkState(type != TransactionType.WRITE_ONLY, - "Reads from write-only transactions are not allowed"); + checkState(type != TransactionType.WRITE_ONLY, "Reads from write-only transactions are not allowed"); LOG.trace("Tx {} {} {}", getIdentifier(), readCmd.getClass().getSimpleName(), readCmd.getPath()); @@ -101,9 +102,8 @@ public class TransactionProxy extends AbstractDOMStoreTransaction>> read(final YangInstanceIdentifier path) { - Preconditions.checkState(type != TransactionType.WRITE_ONLY, - "Reads from write-only transactions are not allowed"); - Preconditions.checkNotNull(path, "path should not be null"); + checkState(type != TransactionType.WRITE_ONLY, "Reads from write-only transactions are not allowed"); + requireNonNull(path, "path should not be null"); LOG.trace("Tx {} read {}", getIdentifier(), path); return path.isEmpty() ? readAllData() : singleShardRead(shardNameFromIdentifier(path), path); @@ -170,10 +170,8 @@ public class TransactionProxy extends AbstractDOMStoreTransaction ready() { - Preconditions.checkState(type != TransactionType.READ_ONLY, "Read-only transactions cannot be readied"); + checkState(type != TransactionType.READ_ONLY, "Read-only transactions cannot be readied"); final boolean success = seal(TransactionState.READY); - Preconditions.checkState(success, "Transaction %s is %s, it cannot be readied", getIdentifier(), state); + checkState(success, "Transaction %s is %s, it cannot be readied", getIdentifier(), state); LOG.debug("Tx {} Readying {} components for commit", getIdentifier(), txContextWrappers.size());