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%2FShardTransactionFactory.java;h=ecfd2aa50d8375ac3cc184eaf1e55a383bc85df5;hb=6276a65120a674b545ea787a5e1d9311bcdbf2af;hp=3c0387115900d54c17eafb8512736eeef2933542;hpb=4062f5241a2a6f58ffb83dd1e9939ee66122d217;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardTransactionFactory.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardTransactionFactory.java index 3c03871159..ecfd2aa50d 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardTransactionFactory.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardTransactionFactory.java @@ -10,6 +10,10 @@ package org.opendaylight.controller.cluster.datastore; import akka.actor.ActorRef; import akka.actor.UntypedActorContext; import com.google.common.base.Preconditions; +import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier; +import org.opendaylight.controller.cluster.access.concepts.FrontendIdentifier; +import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier; +import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier; import org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard.ShardStats; /** @@ -36,19 +40,35 @@ class ShardTransactionActorFactory { this.shardActor = shardActor; } - ActorRef newShardTransaction(TransactionType type, String transactionID, String transactionChainID) { + private static String actorNameFor(final TransactionIdentifier txId) { + final LocalHistoryIdentifier historyId = txId.getHistoryId(); + final ClientIdentifier clientId = historyId.getClientId(); + final FrontendIdentifier frontendId = clientId.getFrontendId(); + + final StringBuilder sb = new StringBuilder("shard-"); + sb.append(frontendId.getMemberName().getName()).append(':'); + sb.append(frontendId.getClientType().getName()).append('@'); + sb.append(clientId.getGeneration()).append(':'); + if (historyId.getHistoryId() != 0) { + sb.append(historyId.getHistoryId()).append('-'); + } + + return sb.append(txId.getTransactionId()).toString(); + } + + ActorRef newShardTransaction(TransactionType type, TransactionIdentifier transactionID) { final AbstractShardDataTreeTransaction transaction; switch (type) { case READ_ONLY: - transaction = dataTree.newReadOnlyTransaction(transactionID, transactionChainID); + transaction = dataTree.newReadOnlyTransaction(transactionID); shardMBean.incrementReadOnlyTransactionCount(); break; case READ_WRITE: - transaction = dataTree.newReadWriteTransaction(transactionID, transactionChainID); + transaction = dataTree.newReadWriteTransaction(transactionID); shardMBean.incrementReadWriteTransactionCount(); break; case WRITE_ONLY: - transaction = dataTree.newReadWriteTransaction(transactionID, transactionChainID); + transaction = dataTree.newReadWriteTransaction(transactionID); shardMBean.incrementWriteOnlyTransactionCount(); break; default: @@ -56,6 +76,6 @@ class ShardTransactionActorFactory { } return actorContext.actorOf(ShardTransaction.props(type, transaction, shardActor, datastoreContext, shardMBean) - .withDispatcher(txnDispatcherPath), "shard-" + transactionID); + .withDispatcher(txnDispatcherPath), actorNameFor(transactionID)); } }