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=e7da6f458d9278b2276671dc3164c9cde24ac9ef;hp=7d0117f8e18083d75e0dc20b304561919ad23509;hpb=608760751ce7fcf4e84e86a8b33d43bc1d9984d6;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 7d0117f8e1..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,8 +33,13 @@ 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); } } @@ -41,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) {