From: Tom Pantelis Date: Wed, 22 Mar 2017 03:21:37 +0000 (-0400) Subject: Bug 7814: Add counter to make tx actor names unique X-Git-Tag: release/carbon~144 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=42b69ac5defea18d103ce2e1a3ee8156b83af8e8 Bug 7814: Add counter to make tx actor names unique Appended an incrementing counter value to the actor name which will guarantee uniqueness. Change-Id: I0f36c4b96598c6035071ee2becb73ca9b18fee45 Signed-off-by: Tom Pantelis --- diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardTransactionActorFactory.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardTransactionActorFactory.java index 8e9c762bf1..74c75dc254 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardTransactionActorFactory.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardTransactionActorFactory.java @@ -10,6 +10,7 @@ package org.opendaylight.controller.cluster.datastore; import akka.actor.ActorRef; import akka.actor.UntypedActorContext; import com.google.common.base.Preconditions; +import java.util.concurrent.atomic.AtomicLong; import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier; import org.opendaylight.controller.cluster.access.concepts.FrontendIdentifier; import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier; @@ -22,6 +23,7 @@ import org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard.ShardStats * @author Thomas Pantelis */ class ShardTransactionActorFactory { + private static final AtomicLong ACTOR_NAME_COUNTER = new AtomicLong(); private final ShardDataTree dataTree; private final DatastoreContext datastoreContext; @@ -57,7 +59,7 @@ class ShardTransactionActorFactory { sb.append(historyId.getHistoryId()).append('-'); } - return sb.append(txId.getTransactionId()).toString(); + return sb.append(txId.getTransactionId()).append('_').append(ACTOR_NAME_COUNTER.incrementAndGet()).toString(); } ActorRef newShardTransaction(TransactionType type, TransactionIdentifier transactionID) {