Map<ActorRef, ActorRef> monitoredActors = new HashMap<ActorRef, ActorRef>();
@Override
public void onReceive(Object message) throws Exception {
if (message instanceof Terminated) {
final Terminated t = (Terminated) message;
if (monitoredActors.containsKey(t.getActor())) {
log.info("Received Worker Actor Termination Message -> {}", t
.getActor().path());
log.info("Sending message to Supervisor");
monitoredActors.get(t.getActor()).tell(new DeadWorker());
}
} else if (message instanceof RegisterWorker) {
RegisterWorker msg = (RegisterWorker) message;
getContext().watch(msg.worker);