Package co.paralleluniverse.actors

Examples of co.paralleluniverse.actors.MailboxConfig


    private static ActorRef getCurrentActor() {
        ActorRef actorRef = LocalActor.self();
        if (actorRef == null) {
            // create a "dummy actor" on the current strand
            Actor actor = new Actor(Strand.currentStrand(), null, new MailboxConfig(5, OverflowPolicy.THROW)) {
                @Override
                protected Object doRun() throws InterruptedException, SuspendExecution {
                    throw new AssertionError();
                }
            };
View Full Code Here


    private static ActorRef getCurrentActor() {
        ActorRef actorRef = ActorRef.self();
        if (actorRef == null) {
            // create a "dummy actor" on the current strand
            Actor actor = new Actor(Strand.currentStrand(), null, new MailboxConfig(5, OverflowPolicy.THROW)) {
                @Override
                protected Object doRun() throws InterruptedException, SuspendExecution {
                    throw new AssertionError();
                }
            };
View Full Code Here

                        public Integer handleCall(ActorRef<?> from, Object id, Message m) {
                            return m.a + m.b;
                        }
                    }).join();
                } else {
                    Integer get = spawnActor(new BasicActor<Message, Integer>(new MailboxConfig(10, Channels.OverflowPolicy.THROW)) {
                        protected Integer doRun() throws SuspendExecution, InterruptedException {
                            final Server<Message, Integer, Message> gs = (Server) ActorRegistry.getActor("myServer");
                            return gs.call(new Message(3, 4));
                        }
                    }).get();
View Full Code Here

    // The public state is only updated by the owning Spaceship, and only in a SB transaction.
    // Therefore the owning spaceship can read it any time, but anyone else (other spacehips or the renderer) must only do so in
    // a transaction.
    public Spaceship(Spaceships global, int id, Phaser phaser) {
        super(new MailboxConfig(10, Channels.OverflowPolicy.THROW));
        this.id = id;
        this.phaser = phaser;

        this.global = global;
        this.random = global.random;
View Full Code Here

                        public Integer handleCall(Actor<Integer> from, Object id, Message m) {
                            return m.a + m.b;
                        }
                    }).join();
                } else {
                    Integer get = spawnActor(new BasicActor<Message, Integer>(new MailboxConfig(10, Channels.OverflowPolicy.THROW)) {
                        protected Integer doRun() throws SuspendExecution, InterruptedException {
                            final GenServer<Message, Integer, Message> gs = (GenServer) getActor("myServer");
                            return gs.call(new Message(3, 4));
                        }
                    }).get();
View Full Code Here

        return actorRef;
    }

    private static class TempActor extends Actor<Object, Void> {
        TempActor() {
            super(Strand.currentStrand(), null, new MailboxConfig(5, OverflowPolicy.THROW));
        }
View Full Code Here

    public static void main(String[] args) throws ExecutionException, InterruptedException {
        System.setProperty("galaxy.nodeId", Integer.toString(nodeId));
        System.setProperty("galaxy.port", Integer.toString(7050 + nodeId));
        System.setProperty("galaxy.slave_port", Integer.toString(8050 + nodeId));

        Integer res = new Fiber<>(new BasicActor<SumRequest, Integer>(new MailboxConfig(10, Channels.OverflowPolicy.THROW)) {
            protected Integer doRun() throws SuspendExecution, InterruptedException {
                Server<SumRequest, Integer, SumRequest> gs;
                while ((gs = (Server) ActorRegistry.getActor("myServer")) == null) {
                    System.out.println("waiting for myServer");
                    Strand.sleep(3000);
View Full Code Here

                        public Integer handleCall(ActorRef<?> from, Object id, Message m) {
                            return m.a + m.b;
                        }
                    }).join();
                } else {
                    Integer get = spawnActor(new BasicActor<Message, Integer>(new MailboxConfig(10, Channels.OverflowPolicy.THROW)) {
                        protected Integer doRun() throws SuspendExecution, InterruptedException {
                            final Server<Message, Integer, Message> gs = (Server) ActorRegistry.getActor("myServer");
                            return gs.call(new Message(3, 4));
                        }
                    }).get();
View Full Code Here

        return actorRef;
    }

    private static class TempActor extends Actor<Object, Void> {
        TempActor() {
            super(Strand.currentStrand(), null, new MailboxConfig(5, OverflowPolicy.THROW));
        }
View Full Code Here

    private static ActorRef getCurrentActor() {
        ActorRef actorRef = LocalActor.self();
        if (actorRef == null) {
            // create a "dummy actor" on the current strand
            Actor actor = new Actor(Strand.currentStrand(), null, new MailboxConfig(5, OverflowPolicy.THROW)) {
                @Override
                protected Object doRun() throws InterruptedException, SuspendExecution {
                    throw new AssertionError();
                }
            };
View Full Code Here

TOP

Related Classes of co.paralleluniverse.actors.MailboxConfig

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.