Пример #1
0
 @Override
 public void onReceive(Object message) {
   if (message.equals("kill")) {
     getContext().stop(child);
     lastSender = getSender();
   } else if (message instanceof Terminated) {
     final Terminated t = (Terminated) message;
     if (t.getActor() == child) {
       lastSender.tell("finished", getSelf());
     }
   } else {
     unhandled(message);
   }
 }
Пример #2
0
 @Override
 public void onReceive(Object message) {
   if (message instanceof ActorIdentity) {
     ActorIdentity identity = (ActorIdentity) message;
     if (identity.correlationId().equals(identifyId)) {
       ActorRef ref = identity.getRef();
       if (ref == null) getContext().stop(getSelf());
       else {
         another = ref;
         getContext().watch(another);
         // #test-omitted
         probe.tell(ref, getSelf());
         // #test-omitted
       }
     }
   } else if (message instanceof Terminated) {
     final Terminated t = (Terminated) message;
     if (t.getActor().equals(another)) {
       getContext().stop(getSelf());
     }
   } else {
     unhandled(message);
   }
 }