Package co.paralleluniverse.actors

Examples of co.paralleluniverse.actors.ActorRef


                a.sendSync(message);
        }

        @Override
        public boolean send(Message message, long timeout, TimeUnit unit) throws SuspendExecution, InterruptedException {
            final ActorRef a = getActor();
            if (a != null)
                return a.send(message, timeout, unit);
            return true;
        }
View Full Code Here


            return send(msg, timeout.nanosLeft(), TimeUnit.NANOSECONDS);
        }

        @Override
        public boolean trySend(Message message) {
            final ActorRef a = getActor();
            if (a != null)
                return a.trySend(message);
            return true;
        }
View Full Code Here

    @Override
    public void onOpen(Session session, EndpointConfig config) {
        if (this.config == null)
            this.config = config;
        ActorRef webActor = getHttpSessionActor(config).getWebActor();
        if (webActor != null) {
            WebSocketActorRef wsa = attachWebActor(session, config, webActor);
            wsa.onOpen();
        } else {
            try {
View Full Code Here

    }

    @Override
    public <Message> ActorRef<Message> getActor(String name) throws SuspendExecution {
        final String rootName = name;
        ActorRef cacheValue = rootCache.get(rootName);
        if (cacheValue != null)
            return cacheValue;
        serlock.lock();
        try {
            cacheValue = rootCache.get(rootName);
View Full Code Here

        System.setProperty("galaxy.slave_port", Integer.toString(8050 + nodeId));

        ActorRef<Message> ping = new BasicActor<Message, Void>() {
            @Override
            protected Void doRun() throws InterruptedException, SuspendExecution {
                ActorRef pong;
                while ((pong = ActorRegistry.getActor("pong")) == null) {
                    System.out.println("waiting for pong");
                    Strand.sleep(3000);
                }
                System.out.println("pong is " + pong);

                for (int i = 0; i < 3; i++) {
                    pong.send(new Message(self(), PING));
                    Message msg = receive();
                    System.out.println("ping received " + msg.type);
                }

                pong.send(new Message(null, FINISHED));
                return null;
            }
        }.spawn();
        LocalActorUtil.join(ping);
        System.out.println("finished ping");
View Full Code Here

TOP

Related Classes of co.paralleluniverse.actors.ActorRef

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.