Пример #1
0
 public void onReceive(Object message) {
   if (message.equals("bar")) {
     getContext().become(angry);
   } else if (message.equals("foo")) {
     getContext().become(happy);
   } else {
     unhandled(message);
   }
 }
Пример #2
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");
     }
   } else {
     unhandled(message);
   }
 }