Enhancements to actor naming, logging and monitoring
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / Shard.java
index 221e874fd507b6ce1e52016ae09f33d9a0c5d514..3425608d235ddce1555dac19f6bc3e985b65f7f9 100644 (file)
@@ -105,19 +105,19 @@ public class Shard extends UntypedProcessor {
         } else if (message instanceof Persistent) {
             commit((Modification) ((Persistent) message).payload());
         } else if (message instanceof CreateTransaction) {
-            createTransaction();
+            createTransaction((CreateTransaction) message);
         } else if(message instanceof NonPersistent){
             commit((Modification) ((NonPersistent) message).payload());
         }
     }
 
-    private void createTransaction() {
+    private void createTransaction(CreateTransaction createTransaction) {
         DOMStoreReadWriteTransaction transaction =
             store.newReadWriteTransaction();
         ActorRef transactionActor = getContext().actorOf(
-            ShardTransaction.props(transaction, getSelf()));
+            ShardTransaction.props(transaction, getSelf()), "shard-" + createTransaction.getTransactionId());
         getSender()
-            .tell(new CreateTransactionReply(transactionActor.path()),
+            .tell(new CreateTransactionReply(transactionActor.path(), createTransaction.getTransactionId()),
                 getSelf());
     }
 
@@ -139,6 +139,7 @@ public class Shard extends UntypedProcessor {
                     future.get();
                     sender.tell(new CommitTransactionReply(), self);
                 } catch (InterruptedException | ExecutionException e) {
+                    // FIXME : Handle this properly
                     log.error(e, "An exception happened when committing");
                 }
             }
@@ -146,7 +147,6 @@ public class Shard extends UntypedProcessor {
     }
 
     private void handleForwardedCommit(ForwardedCommitTransaction message) {
-        log.info("received forwarded transaction");
         modificationToCohort
             .put(message.getModification(), message.getCohort());
         if(persistent) {