Examples of ChildSpec


Examples of co.paralleluniverse.actors.behaviors.Supervisor.ChildSpec

    }

    @Test
    public void startChild() throws Exception {
        final Supervisor sup = new SupervisorActor(RestartStrategy.ONE_FOR_ONE,
                new ChildSpec("actor1", ChildMode.PERMANENT, 5, 1, TimeUnit.SECONDS, 3, ActorSpec.of(Actor1.class, "actor1"))).spawn(scheduler);

        ActorRef<Object> a;

        a = getChild(sup, "actor1", 1000);
        for (int i = 0; i < 3; i++)
View Full Code Here

Examples of co.paralleluniverse.actors.behaviors.Supervisor.ChildSpec

    }

    @Test
    public void whenChildDiesThenRestart() throws Exception {
        final Supervisor sup = new SupervisorActor(RestartStrategy.ONE_FOR_ONE,
                new ChildSpec("actor1", ChildMode.PERMANENT, 5, 1, TimeUnit.SECONDS, 3, ActorSpec.of(Actor1.class, "actor1"))).spawn(scheduler);

        ActorRef<Object> a;

        a = getChild(sup, "actor1", 1000);
        for (int i = 0; i < 3; i++)
View Full Code Here

Examples of co.paralleluniverse.actors.behaviors.Supervisor.ChildSpec

    }

    @Test
    public void whenChildDiesTooManyTimesThenGiveUpAndDie() throws Exception {
        final Supervisor sup = new SupervisorActor(RestartStrategy.ONE_FOR_ONE,
                new ChildSpec("actor1", ChildMode.PERMANENT, 3, 1, TimeUnit.SECONDS, 3, ActorSpec.of(BadActor1.class, "actor1"))).spawn();

        ActorRef<Object> a, prevA = null;

        for (int k = 0; k < 4; k++) {
            a = getChild(sup, "actor1", 1000);
View Full Code Here

Examples of co.paralleluniverse.actors.behaviors.Supervisor.ChildSpec

    }

    @Test
    public void dontRestartTemporaryChildDeadOfNaturalCause() throws Exception {
        final Supervisor sup = new SupervisorActor(RestartStrategy.ONE_FOR_ONE,
                new ChildSpec("actor1", ChildMode.TEMPORARY, 5, 1, TimeUnit.SECONDS, 3, ActorSpec.of(Actor1.class, "actor1"))).spawn();

        ActorRef<Object> a;

        a = getChild(sup, "actor1", 1000);
        for (int i = 0; i < 3; i++)
View Full Code Here

Examples of co.paralleluniverse.actors.behaviors.Supervisor.ChildSpec

    }

    @Test
    public void dontRestartTemporaryChildDeadOfUnnaturalCause() throws Exception {
        final Supervisor sup = new SupervisorActor(RestartStrategy.ONE_FOR_ONE,
                new ChildSpec("actor1", ChildMode.TEMPORARY, 5, 1, TimeUnit.SECONDS, 3, ActorSpec.of(BadActor1.class, "actor1"))).spawn(scheduler);

        ActorRef<Object> a;

        a = getChild(sup, "actor1", 1000);
        for (int i = 0; i < 3; i++)
View Full Code Here

Examples of co.paralleluniverse.actors.behaviors.Supervisor.ChildSpec

    }

    @Test
    public void dontRestartTransientChildDeadOfNaturalCause() throws Exception {
        final Supervisor sup = new SupervisorActor(RestartStrategy.ONE_FOR_ONE,
                new ChildSpec("actor1", ChildMode.TRANSIENT, 5, 1, TimeUnit.SECONDS, 3, ActorSpec.of(Actor1.class, "actor1"))).spawn();

        ActorRef<Object> a;

        a = getChild(sup, "actor1", 1000);
        for (int i = 0; i < 3; i++)
View Full Code Here

Examples of co.paralleluniverse.actors.behaviors.Supervisor.ChildSpec

    }

    @Test
    public void restartTransientChildDeadOfUnnaturalCause() throws Exception {
        final Supervisor sup = new SupervisorActor(RestartStrategy.ONE_FOR_ONE,
                new ChildSpec("actor1", ChildMode.TRANSIENT, 5, 1, TimeUnit.SECONDS, 3, ActorSpec.of(BadActor1.class, "actor1"))).spawn();

        ActorRef<Object> a;

        a = getChild(sup, "actor1", 1000);
        for (int i = 0; i < 3; i++)
View Full Code Here

Examples of co.paralleluniverse.actors.behaviors.Supervisor.ChildSpec

    @Test
    public void restartPreInstantiatedChild() throws Exception {
        final Supervisor sup = new SupervisorActor(RestartStrategy.ONE_FOR_ONE).spawn();

        final ActorRef<Object> a1 = new Actor2("actor1").spawn();
        sup.addChild(new ChildSpec("actor1", ChildMode.PERMANENT, 5, 1, TimeUnit.SECONDS, 3, a1));
        ActorRef<Object> a;

        a = getChild(sup, "actor1", 1);

        assertThat(a, equalTo(a1));
View Full Code Here

Examples of co.paralleluniverse.actors.behaviors.Supervisor.ChildSpec

    public void testComplex1() throws Exception {
        AtomicInteger started = new AtomicInteger();
        AtomicInteger terminated = new AtomicInteger();

        final Supervisor sup = new SupervisorActor(RestartStrategy.ALL_FOR_ONE,
                new ChildSpec("actor1", ChildMode.PERMANENT, 5, 1, TimeUnit.SECONDS, 3, ActorSpec.of(Actor3.class, "actor1", started, terminated))).spawn();

        ActorRef<Integer> a;

        a = getChild(sup, "actor1", 1000);
        a.send(3);
View Full Code Here

Examples of co.paralleluniverse.actors.behaviors.Supervisor.ChildSpec

                    return res;
                }
            }.spawn();

            //link(adder);
            mySup.addChild(new ChildSpec(null, ChildMode.TEMPORARY, 10, 1, TimeUnit.SECONDS, 1, adder));

            int a = receive();
            int b = receive();

            int res = adder.call(new Message1(a, b));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.