Package edu.brown.net

Examples of edu.brown.net.NonBlockingConnection


            throw new RuntimeException(e);
        }
        assert client != null;

        // wrap it in a message connection and register with event loop
        ProtoConnection connection = new ProtoConnection(new NonBlockingConnection(client));

        eventLoop.registerRead(client, new EventCallbackWrapper(connection));
//        SelectionKey clientKey = connection.register(selector);
//        clientKey.attach(connection);
//        eventQueue.add(new Event(connection, null));
View Full Code Here


        if (exitLoopHandler.barrierCount == 0) {
            ProtoRpcChannel[] rpcChannels = new ProtoRpcChannel[addresses.length];
            for (int i = 0; i < channels.length; ++i) {
                rpcChannels[i] = new ProtoRpcChannel(eventLoop,
                        new StaticConnectFactory(new NonBlockingConnection(channels[i].channel)));
            }
            return rpcChannels;
        } else {
            // Close any open channels in case connects are pending
            for (ConnectHandler connectHandler : channels) {
View Full Code Here

        @Override
        public NonBlockingConnection startNewConnection() {
            try {
                SocketChannel socket = SocketChannel.open();
                NonBlockingConnection connection = new NonBlockingConnection(socket);

                // this connect is non-blocking and should always return false.
                boolean finished = ((SocketChannel) connection.getChannel()).connect(address);
                if (finished) {
                    throw new IllegalStateException("async connect finished instantly?");
                }
                return connection;
            } catch (IOException e) {
View Full Code Here

            this.connection = connection;
        }

        @Override
        public NonBlockingConnection startNewConnection() {
            NonBlockingConnection out = connection;
            connection = null;
            return out;
        }
View Full Code Here

    ProtoConnection connection;

    @Before
    public void setUp() throws IOException {
        channel = new MockByteChannel();
        connection = new ProtoConnection(new NonBlockingConnection(null, channel));
    }
View Full Code Here

TOP

Related Classes of edu.brown.net.NonBlockingConnection

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.