Eliminate dead letters message when there's no sender
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / DataTreeChangeListenerRegistrationActor.java
index 2a106b4..5994f30 100644 (file)
@@ -32,7 +32,10 @@ public final class DataTreeChangeListenerRegistrationActor extends AbstractUntyp
     protected void handleReceive(Object message) throws Exception {
         if (message instanceof CloseDataTreeChangeListenerRegistration) {
             registration.close();
     protected void handleReceive(Object message) throws Exception {
         if (message instanceof CloseDataTreeChangeListenerRegistration) {
             registration.close();
-            getSender().tell(CloseDataTreeChangeListenerRegistrationReply.getInstance(), getSelf());
+            if(isValidSender(getSender())) {
+                getSender().tell(CloseDataTreeChangeListenerRegistrationReply.getInstance(), getSelf());
+            }
+
             getSelf().tell(PoisonPill.getInstance(), getSelf());
         } else {
             unknownMessage(message);
             getSelf().tell(PoisonPill.getInstance(), getSelf());
         } else {
             unknownMessage(message);