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=887f656205182564f5e28a7027ce8a4b337c23e5;hpb=a51163ead1d60e66eeaf3691adb70b019ce60fb2;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 887f656205..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,7 +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.datastore.identifiers.ShardTransactionIdentifier; +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; /** @@ -37,28 +40,42 @@ class ShardTransactionActorFactory { this.shardActor = shardActor; } - ActorRef newShardTransaction(TransactionType type, ShardTransactionIdentifier transactionID, - String transactionChainID, short clientVersion) { + 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.toString(), transactionChainID); + transaction = dataTree.newReadOnlyTransaction(transactionID); shardMBean.incrementReadOnlyTransactionCount(); break; case READ_WRITE: - transaction = dataTree.newReadWriteTransaction(transactionID.toString(), transactionChainID); + transaction = dataTree.newReadWriteTransaction(transactionID); shardMBean.incrementReadWriteTransactionCount(); break; case WRITE_ONLY: - transaction = dataTree.newReadWriteTransaction(transactionID.toString(), transactionChainID); + transaction = dataTree.newReadWriteTransaction(transactionID); shardMBean.incrementWriteOnlyTransactionCount(); break; default: throw new IllegalArgumentException("Unsupported transaction type " + type); } - return actorContext.actorOf(ShardTransaction.props(type, transaction, shardActor, datastoreContext, shardMBean, - transactionID.getRemoteTransactionId(), clientVersion).withDispatcher(txnDispatcherPath), - transactionID.toString()); + return actorContext.actorOf(ShardTransaction.props(type, transaction, shardActor, datastoreContext, shardMBean) + .withDispatcher(txnDispatcherPath), actorNameFor(transactionID)); } }