X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FTransactionReadyReplyMapper.java;h=f5eb0e4be68fc023bc995f5f49c286a1537438d6;hb=0175a376323f6c916b5a4340a27751ebef22fc83;hp=986cca5f3d400dfeb4ce40c81355242b161cced5;hpb=925cb4a228d0fda99c7bfeb432eb25285a223887;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionReadyReplyMapper.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionReadyReplyMapper.java index 986cca5f3d..f5eb0e4be6 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionReadyReplyMapper.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionReadyReplyMapper.java @@ -7,12 +7,13 @@ */ package org.opendaylight.controller.cluster.datastore; +import static java.util.Objects.requireNonNull; + import akka.actor.ActorSelection; import akka.dispatch.Mapper; -import com.google.common.base.Preconditions; import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier; import org.opendaylight.controller.cluster.datastore.messages.ReadyTransactionReply; -import org.opendaylight.controller.cluster.datastore.utils.ActorContext; +import org.opendaylight.controller.cluster.datastore.utils.ActorUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import scala.concurrent.Future; @@ -20,7 +21,8 @@ import scala.concurrent.Future; /** * A {@link Mapper} extracting the {@link ActorSelection} pointing to the actor which * is backing a particular transaction. - *

+ * + *

* This class is not for general consumption. It is public only to support the pre-lithium compatibility * package. * TODO: once we remove compatibility, make this class package-private and final. @@ -34,15 +36,15 @@ public class TransactionReadyReplyMapper extends Mapper }; private static final Logger LOG = LoggerFactory.getLogger(TransactionReadyReplyMapper.class); private final TransactionIdentifier identifier; - private final ActorContext actorContext; + private final ActorUtils actorUtils; - protected TransactionReadyReplyMapper(final ActorContext actorContext, final TransactionIdentifier identifier) { - this.actorContext = Preconditions.checkNotNull(actorContext); - this.identifier = Preconditions.checkNotNull(identifier); + protected TransactionReadyReplyMapper(final ActorUtils actorUtils, final TransactionIdentifier identifier) { + this.actorUtils = requireNonNull(actorUtils); + this.identifier = requireNonNull(identifier); } - protected final ActorContext getActorContext() { - return actorContext; + protected final ActorUtils getActorUtils() { + return actorUtils; } protected String extractCohortPathFrom(final ReadyTransactionReply readyTxReply) { @@ -57,7 +59,7 @@ public class TransactionReadyReplyMapper extends Mapper // actor path from the reply. if (ReadyTransactionReply.isSerializedType(serializedReadyReply)) { ReadyTransactionReply readyTxReply = ReadyTransactionReply.fromSerializable(serializedReadyReply); - return actorContext.actorSelection(extractCohortPathFrom(readyTxReply)); + return actorUtils.actorSelection(extractCohortPathFrom(readyTxReply)); } // Throwing an exception here will fail the Future. @@ -65,9 +67,9 @@ public class TransactionReadyReplyMapper extends Mapper identifier, serializedReadyReply.getClass())); } - static Future transform(final Future readyReplyFuture, final ActorContext actorContext, + static Future transform(final Future readyReplyFuture, final ActorUtils actorUtils, final TransactionIdentifier identifier) { - return readyReplyFuture.transform(new TransactionReadyReplyMapper(actorContext, identifier), - SAME_FAILURE_TRANSFORMER, actorContext.getClientDispatcher()); + return readyReplyFuture.transform(new TransactionReadyReplyMapper(actorUtils, identifier), + SAME_FAILURE_TRANSFORMER, actorUtils.getClientDispatcher()); } }