Package akka.actor

Examples of akka.actor.Terminated


  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);
View Full Code Here


        ask(supervisorActorRef2, new Props(BoomActor.class), 5000),
        Duration.parse("5 second"));
    probe.watch(child);
    // second check
    child.tell("do something");
    probe.expectMsg(new Terminated(child));

  }
View Full Code Here

    } else if (message.equals(BACKEND_REGISTRATION)) {
      getContext().watch(getSender());
      backends.add(getSender());

    } else if (message instanceof Terminated) {
      Terminated terminated = (Terminated) message;
      backends.remove(terminated.getActor());

    } else {
      unhandled(message);
    }
  }
View Full Code Here

    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);
      }
View Full Code Here

            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);
      }
View Full Code Here

    //#test-probe-watch
    new JavaTestKit(system) {{
      final JavaTestKit probe = new JavaTestKit(system);
      probe.watch(target);
      target.tell(PoisonPill.getInstance(), ActorRef.noSender());
      final Terminated msg = probe.expectMsgClass(Terminated.class);
      assertEquals(msg.getActor(), target);
    }};
    //#test-probe-watch
  }
View Full Code Here

TOP

Related Classes of akka.actor.Terminated

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.