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%2FThreePhaseCommitCohortProxy.java;h=cd79ad6f19ed32fdb37a6b8204e1de0a47ee2ccd;hp=9505894b4b1cad73fd0d264ee8b7ba641f26ae66;hb=e84f63ee098fff5b02cbce1281ca0d1208f966fa;hpb=f83b2d36fdd7e953ba72492ffb684cd112aa04a6 diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxy.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxy.java index 9505894b4b..cd79ad6f19 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxy.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxy.java @@ -12,8 +12,6 @@ import static java.util.Objects.requireNonNull; import akka.actor.ActorSelection; import akka.dispatch.OnComplete; -import com.google.common.base.Supplier; -import com.google.common.collect.Lists; import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; @@ -23,6 +21,7 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Supplier; import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier; import org.opendaylight.controller.cluster.datastore.messages.AbortTransaction; import org.opendaylight.controller.cluster.datastore.messages.AbortTransactionReply; @@ -158,7 +157,7 @@ public class ThreePhaseCommitCohortProxy extends AbstractThreePhaseCommitCohort< final Iterator iterator = cohorts.iterator(); - final OnComplete onComplete = new OnComplete() { + final OnComplete onComplete = new OnComplete<>() { @Override public void onComplete(final Throwable failure, final Object response) { if (failure != null) { @@ -193,7 +192,7 @@ public class ThreePhaseCommitCohortProxy extends AbstractThreePhaseCommitCohort< sendCanCommitTransaction(iterator.next(), this); } else { LOG.debug("Tx {}: canCommit returning result: {}", transactionId, result); - returnFuture.set(Boolean.valueOf(result)); + returnFuture.set(result); } } @@ -213,7 +212,7 @@ public class ThreePhaseCommitCohortProxy extends AbstractThreePhaseCommitCohort< } private Future> invokeCohorts(final MessageSupplier messageSupplier) { - List> futureList = Lists.newArrayListWithCapacity(cohorts.size()); + List> futureList = new ArrayList<>(cohorts.size()); for (CohortInfo cohort : cohorts) { Object message = messageSupplier.newMessage(transactionId, cohort.getActorVersion()); @@ -366,9 +365,10 @@ public class ThreePhaseCommitCohortProxy extends AbstractThreePhaseCommitCohort< static class CohortInfo { private final Future actorFuture; - private volatile ActorSelection resolvedActor; private final Supplier actorVersionSupplier; + private volatile ActorSelection resolvedActor; + CohortInfo(final Future actorFuture, final Supplier actorVersionSupplier) { this.actorFuture = actorFuture; this.actorVersionSupplier = actorVersionSupplier;