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%2FThreePhaseCommitCohort.java;h=df85bb136a93b51084676a39cb1d7b53b54b7037;hp=5a6d0eca5c2a159963febc4ee9d6436f2e864a5d;hb=c352d8958cf16d2eded7bb103b7be69546164ce5;hpb=3a8636987a20a584ad25af7aba11ffcade21ebe3 diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohort.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohort.java index 5a6d0eca5c..df85bb136a 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohort.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohort.java @@ -18,8 +18,9 @@ import akka.japi.Creator; import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; +import org.opendaylight.controller.cluster.common.actor.AbstractUntypedActor; -import org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard.ShardMBeanFactory; +import org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard.ShardStats; import org.opendaylight.controller.cluster.datastore.messages.AbortTransaction; import org.opendaylight.controller.cluster.datastore.messages.AbortTransactionReply; import org.opendaylight.controller.cluster.datastore.messages.CanCommitTransaction; @@ -35,25 +36,25 @@ public class ThreePhaseCommitCohort extends AbstractUntypedActor { private final DOMStoreThreePhaseCommitCohort cohort; private final ActorRef shardActor; private final CompositeModification modification; - private final String shardName; + private final ShardStats shardStats; public ThreePhaseCommitCohort(DOMStoreThreePhaseCommitCohort cohort, - ActorRef shardActor, CompositeModification modification,String shardName) { + ActorRef shardActor, CompositeModification modification, ShardStats shardStats) { this.cohort = cohort; this.shardActor = shardActor; this.modification = modification; - this.shardName = shardName; + this.shardStats = shardStats; } private final LoggingAdapter log = Logging.getLogger(getContext().system(), this); public static Props props(final DOMStoreThreePhaseCommitCohort cohort, - final ActorRef shardActor, final CompositeModification modification, - String shardName) { + final ActorRef shardActor, final CompositeModification modification, + ShardStats shardStats) { return Props.create(new ThreePhaseCommitCohortCreator(cohort, shardActor, modification, - shardName)); + shardStats)); } @Override @@ -83,7 +84,7 @@ public class ThreePhaseCommitCohort extends AbstractUntypedActor { Futures.addCallback(future, new FutureCallback() { @Override public void onSuccess(Void v) { - ShardMBeanFactory.getShardStatsMBean(shardName).incrementAbortTransactionsCount(); + shardStats.incrementAbortTransactionsCount(); sender .tell(new AbortTransactionReply().toSerializable(), self); @@ -100,7 +101,9 @@ public class ThreePhaseCommitCohort extends AbstractUntypedActor { private void commit(CommitTransaction message) { // Forward the commit to the shard - log.debug("Forward commit transaction to Shard {} ", shardActor); + if(log.isDebugEnabled()) { + log.debug("Forward commit transaction to Shard {} ", shardActor); + } shardActor.forward(new ForwardedCommitTransaction(cohort, modification), getContext()); @@ -154,19 +157,19 @@ public class ThreePhaseCommitCohort extends AbstractUntypedActor { final DOMStoreThreePhaseCommitCohort cohort; final ActorRef shardActor; final CompositeModification modification; - final String shardName; + final ShardStats shardStats; ThreePhaseCommitCohortCreator(DOMStoreThreePhaseCommitCohort cohort, - ActorRef shardActor, CompositeModification modification, String shardName) { + ActorRef shardActor, CompositeModification modification, ShardStats shardStats) { this.cohort = cohort; this.shardActor = shardActor; this.modification = modification; - this.shardName = shardName; + this.shardStats = shardStats; } @Override public ThreePhaseCommitCohort create() throws Exception { - return new ThreePhaseCommitCohort(cohort, shardActor, modification, shardName); + return new ThreePhaseCommitCohort(cohort, shardActor, modification, shardStats); } } }