Bug 7814: Add counter to make tx actor names unique 46/53646/1
authorTom Pantelis <tpanteli@brocade.com>
Wed, 22 Mar 2017 03:21:37 +0000 (23:21 -0400)
committerTom Pantelis <tpanteli@brocade.com>
Wed, 22 Mar 2017 03:21:37 +0000 (23:21 -0400)
Appended an incrementing counter value to the actor name which
will guarantee uniqueness.

Change-Id: I0f36c4b96598c6035071ee2becb73ca9b18fee45
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardTransactionActorFactory.java

index 8e9c762..74c75dc 100644 (file)
@@ -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) {

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.