Use terminate message in eos listener actors
[controller.git] / opendaylight / md-sal / eos-dom-akka / src / main / java / org / opendaylight / controller / eos / akka / registry / listener / type / EntityTypeListenerRegistry.java
index c853124d9a2af30a7e7459ba570fdc625f42c754..e4f7b48d04dcbb7334927902ef9519f719663ac5 100644 (file)
@@ -19,6 +19,7 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
 import org.opendaylight.controller.eos.akka.registry.listener.type.command.RegisterListener;
+import org.opendaylight.controller.eos.akka.registry.listener.type.command.TerminateListener;
 import org.opendaylight.controller.eos.akka.registry.listener.type.command.TypeListenerCommand;
 import org.opendaylight.controller.eos.akka.registry.listener.type.command.TypeListenerRegistryCommand;
 import org.opendaylight.controller.eos.akka.registry.listener.type.command.UnregisterListener;
@@ -65,7 +66,7 @@ public class EntityTypeListenerRegistry extends AbstractBehavior<TypeListenerReg
     private Behavior<TypeListenerRegistryCommand> onUnregisterListener(final UnregisterListener command) {
         LOG.debug("Stopping entity type listener actor for: {}", command.getEntityType());
 
-        getContext().stop(spawnedListenerActors.remove(command.getDelegateListener()));
+        spawnedListenerActors.remove(command.getDelegateListener()).tell(TerminateListener.INSTANCE);
         return this;
     }