Package co.paralleluniverse.actors

Examples of co.paralleluniverse.actors.MailboxConfig


    private static Actor getCurrentActor() {
        Actor actor = LocalActor.self();
        if (actor == null) {
            // create a "dummy actor" on the current strand
            actor = new LocalActor(Strand.currentStrand(), null, new MailboxConfig(5, OverflowPolicy.THROW)) {
                @Override
                protected Object doRun() throws InterruptedException, SuspendExecution {
                    throw new AssertionError();
                }
            };
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 {
                GenServer<SumRequest, Integer, SumRequest> gs;
                while ((gs = (GenServer) ActorRegistry.getActor("myServer")) == null) {
                    System.out.println("waiting for myServer");
                    Strand.sleep(3000);
View Full Code Here

                        public Integer handleCall(ActorRef<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) ActorRegistry.getActor("myServer");
                            return gs.call(new Message(3, 4));
                        }
                    }).get();
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.