public void onReceive(Object message) { if (message.equals("bar")) { getContext().become(angry); } else if (message.equals("foo")) { getContext().become(happy); } else { unhandled(message); } }
@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); } }