Implement DataChangeListener
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / ThreePhaseCommitCohort.java
index 00d4ab5782e3e7f0a365bdd9ace5be917b423dc1..060c9d6b509ab26f481a59c492da753ab70a2400 100644 (file)
@@ -9,8 +9,8 @@
 package org.opendaylight.controller.cluster.datastore;
 
 import akka.actor.ActorRef;
+import akka.actor.PoisonPill;
 import akka.actor.Props;
-import akka.actor.UntypedActor;
 import akka.event.Logging;
 import akka.event.LoggingAdapter;
 import akka.japi.Creator;
@@ -28,7 +28,7 @@ import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCoh
 
 import java.util.concurrent.ExecutionException;
 
-public class ThreePhaseCommitCohort extends UntypedActor {
+public class ThreePhaseCommitCohort extends AbstractUntypedActor {
     private final DOMStoreThreePhaseCommitCohort cohort;
     private final ActorRef shardActor;
     private final CompositeModification modification;
@@ -55,10 +55,9 @@ public class ThreePhaseCommitCohort extends UntypedActor {
         });
     }
 
-    @Override
-    public void onReceive(Object message) throws Exception {
-        log.debug("Received message {}", message);
 
+    @Override
+    public void handleReceive(Object message) throws Exception {
         if (message instanceof CanCommitTransaction) {
             canCommit((CanCommitTransaction) message);
         } else if (message instanceof PreCommitTransaction) {
@@ -94,6 +93,8 @@ public class ThreePhaseCommitCohort extends UntypedActor {
         shardActor.forward(new ForwardedCommitTransaction(cohort, modification),
             getContext());
 
+        getContext().parent().tell(PoisonPill.getInstance(), getSelf());
+
     }
 
     private void preCommit(PreCommitTransaction message) {