BUG-5280: eliminate ShardTransactionIdentifier
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / ShardTransactionFactory.java
index 3a92062e7f86972d55fe7f230c655898d0f0acfb..3c0387115900d54c17eafb8512736eeef2933542 100644 (file)
@@ -7,10 +7,9 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
-import com.google.common.base.Preconditions;
 import akka.actor.ActorRef;
 import akka.actor.UntypedActorContext;
-import org.opendaylight.controller.cluster.datastore.identifiers.ShardTransactionIdentifier;
+import com.google.common.base.Preconditions;
 import org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard.ShardStats;
 
 /**
@@ -37,23 +36,26 @@ class ShardTransactionActorFactory {
         this.shardActor = shardActor;
     }
 
-    ActorRef newShardTransaction(TransactionProxy.TransactionType type, ShardTransactionIdentifier transactionID,
-            String transactionChainID, short clientVersion) {
+    ActorRef newShardTransaction(TransactionType type, String transactionID, String transactionChainID) {
         final AbstractShardDataTreeTransaction<?> transaction;
         switch (type) {
         case READ_ONLY:
-            transaction = dataTree.newReadOnlyTransaction(transactionID.toString(), transactionChainID);
+            transaction = dataTree.newReadOnlyTransaction(transactionID, transactionChainID);
+            shardMBean.incrementReadOnlyTransactionCount();
             break;
         case READ_WRITE:
+            transaction = dataTree.newReadWriteTransaction(transactionID, transactionChainID);
+            shardMBean.incrementReadWriteTransactionCount();
+            break;
         case WRITE_ONLY:
-            transaction = dataTree.newReadWriteTransaction(transactionID.toString(), transactionChainID);
+            transaction = dataTree.newReadWriteTransaction(transactionID, transactionChainID);
+            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), "shard-" + transactionID);
     }
 }