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%2FDataTreeChangeListenerRegistrationActor.java;h=17deeeb4dc261cbe1c1c3e0e07e7b61f0259668c;hb=583f30d1c7a8199b401c9393745c62fe27b5ced8;hp=2a106b4ddaa098368ac0cbe5d325ffe7af807588;hpb=5db008370b529e46305931f94e937f8b332ec299;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeChangeListenerRegistrationActor.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeChangeListenerRegistrationActor.java index 2a106b4dda..17deeeb4dc 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeChangeListenerRegistrationActor.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeChangeListenerRegistrationActor.java @@ -11,6 +11,7 @@ import akka.actor.PoisonPill; import akka.actor.Props; import akka.japi.Creator; import com.google.common.base.Preconditions; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import org.opendaylight.controller.cluster.common.actor.AbstractUntypedActor; import org.opendaylight.controller.cluster.datastore.messages.CloseDataTreeChangeListenerRegistration; import org.opendaylight.controller.cluster.datastore.messages.CloseDataTreeChangeListenerRegistrationReply; @@ -32,7 +33,10 @@ public final class DataTreeChangeListenerRegistrationActor extends AbstractUntyp 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); @@ -43,8 +47,12 @@ public final class DataTreeChangeListenerRegistrationActor extends AbstractUntyp return Props.create(new DataTreeChangeListenerRegistrationCreator(registration)); } - private static final class DataTreeChangeListenerRegistrationCreator implements Creator { + private static final class DataTreeChangeListenerRegistrationCreator + implements Creator { private static final long serialVersionUID = 1L; + + @SuppressFBWarnings(value = "SE_BAD_FIELD", justification = "This field is not Serializable but we don't " + + "create remote instances of this actor and thus don't need it to be Serializable.") final ListenerRegistration registration; DataTreeChangeListenerRegistrationCreator(ListenerRegistration registration) {