Package co.paralleluniverse.actors

Examples of co.paralleluniverse.actors.ShutdownMessage


        ActorRef<Object> a;

        a = getChild(sup, "actor1", 1000);
        for (int i = 0; i < 3; i++)
            a.send(1);
        a.send(new ShutdownMessage(null));
        assertThat(LocalActor.<Integer>get(a), is(3));

        a = getChild(sup, "actor1", 1000);
        for (int i = 0; i < 5; i++)
            a.send(1);
        a.send(new ShutdownMessage(null));
        assertThat(LocalActor.<Integer>get(a), is(5));

        sup.shutdown();
        LocalActor.join(sup);
    }
View Full Code Here


        ActorRef<Object> a;

        a = getChild(sup, "actor1", 1000);
        for (int i = 0; i < 3; i++)
            a.send(1);
        a.send(new ShutdownMessage(null));
        assertThat(LocalActor.<Integer>get(a), is(3));

        a = getChild(sup, "actor1", 200);
        assertThat(a, nullValue());
View Full Code Here

        ActorRef<Object> a;

        a = getChild(sup, "actor1", 1000);
        for (int i = 0; i < 3; i++)
            a.send(1);
        a.send(new ShutdownMessage(null));
        try {
            LocalActor.join(a);
            fail();
        } catch (ExecutionException e) {
        }
View Full Code Here

        ActorRef<Object> a;

        a = getChild(sup, "actor1", 1000);
        for (int i = 0; i < 3; i++)
            a.send(1);
        a.send(new ShutdownMessage(null));
        assertThat(LocalActor.<Integer>get(a), is(3));

        a = getChild(sup, "actor1", 200);
        assertThat(a, nullValue());
View Full Code Here

        ActorRef<Object> a;

        a = getChild(sup, "actor1", 1000);
        for (int i = 0; i < 3; i++)
            a.send(1);
        a.send(new ShutdownMessage(null));
        try {
            LocalActor.join(a);
            fail();
        } catch (ExecutionException e) {
        }
View Full Code Here

        assertThat(a, equalTo(a1));

        for (int i = 0; i < 3; i++)
            a.send(1);
        a.send(new ShutdownMessage(null));
        assertThat(LocalActor.<Integer>get(a), is(3));

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

        assertThat(a, is(not(equalTo(a1))));

        for (int i = 0; i < 5; i++)
            a.send(1);
        a.send(new ShutdownMessage(null));
        assertThat(LocalActor.<Integer>get(a), is(5));

        sup.shutdown();
        LocalActor.join(sup);
    }
View Full Code Here

    private void shutdownChild(ChildEntry child, boolean beforeRestart) throws InterruptedException {
        if (child.actor != null) {
            unwatch(child);
            if (!isLocal(child.actor) || !LocalActor.isDone(child.actor)) {
                log().info("{} shutting down child {}", this, child.actor);
                ActorUtil.sendOrInterrupt(child.actor, new ShutdownMessage(this.ref()));
            }

            if (isLocal(child.actor)) {
                try {
                    joinChild(child);
View Full Code Here

    private void shutdownChildren() throws InterruptedException {
        log().info("{} shutting down all children.", this);
        for (ChildEntry child : children) {
            if (child.actor != null) {
                unwatch(child);
                ActorUtil.sendOrInterrupt(child.actor, new ShutdownMessage(this.ref()));
            }
        }

        for (ChildEntry child : children) {
            if (child.actor != null && isLocal(child.actor)) {
View Full Code Here

    /**
     * Asks this actor to shut down. Works by sending a {@link ShutdownMessage} via {@link ActorUtil#sendOrInterrupt(ActorRef, Object) ActorUtil.sendOrInterrupt}.
     */
    @Override
    public void shutdown() {
        final ShutdownMessage message = new ShutdownMessage(LocalActor.self());
        ActorUtil.sendOrInterrupt(getRef(), message);
    }
View Full Code Here

            log().debug("Shutdown requested.");
            run = false;
            getStrand().interrupt();
        } else {
            try {
                final ShutdownMessage message = new ShutdownMessage(LocalActor.self());
                sendOrInterrupt(message);
            } catch (QueueCapacityExceededException e) {
                final Strand strand = getStrand();
                if (strand != null)
                    strand.interrupt();
View Full Code Here

TOP

Related Classes of co.paralleluniverse.actors.ShutdownMessage

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.