Package akka.actor

Examples of akka.actor.OneForOneStrategy


        }
    };

    public static SupervisorStrategy oneForOne(int maxRetries, int duringSec)
    {
        return new OneForOneStrategy(maxRetries, Duration.create(duringSec, TimeUnit.SECONDS), stopDecider);
    }
View Full Code Here


        return new AllForOneStrategy(maxRetries, Duration.create(duringSec, TimeUnit.SECONDS), stopDecider);
    }

    public static SupervisorStrategy oneForOne(int maxRetries, int duringSec, Function<Throwable, Directive> decider)
    {
        return new OneForOneStrategy(maxRetries, Duration.create(duringSec, TimeUnit.SECONDS), decider);
    }
View Full Code Here

 
  @Test
  public void demonstrateSupervisor() {
    //#supervision
    final SupervisorStrategy strategy =
      new OneForOneStrategy(5, Duration.create(1, TimeUnit.MINUTES),
        Collections.<Class<? extends Throwable>>singletonList(Exception.class));
    final ActorRef router = system.actorOf(new RoundRobinPool(5).
      withSupervisorStrategy(strategy).props(Props.create(Echo.class)));
    //#supervision
  }
View Full Code Here

  @Test
  public void useKill() {
    new JavaTestKit(system) {
      {
        class Master extends UntypedActor {
          private SupervisorStrategy strategy = new OneForOneStrategy(-1,
              Duration.Undefined(), new Function<Throwable, Directive>() {
            @Override
            public Directive apply(Throwable thr) {
              if (thr instanceof ActorKilledException) {
                target.tell("killed", getSelf());
View Full Code Here

    private AskParam askParam;
    private Cancellable timeoutMessage;

    @Override
    public SupervisorStrategy supervisorStrategy() {
      return new OneForOneStrategy(0, Duration.Zero(),
          new Function<Throwable, Directive>() {
            public Directive apply(Throwable cause) {
              caller.tell(new Status.Failure(cause), self());
              return SupervisorStrategy.stop();
            }
View Full Code Here

TOP

Related Classes of akka.actor.OneForOneStrategy

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.