Package io.netty.channel

Examples of io.netty.channel.EventLoopGroup.register()


        EventLoopGroup eventLoopGroup = process.getEventLoop().getEventLoopGroup();
        Channel channel = NioOutputStreamChannel.create(process, out);
        channel.config().setAutoRead(false);
        channel.pipeline().addLast( new DataEventHandler( process, handle ));
        eventLoopGroup.register(channel);

        return channel.newSucceededFuture();
    }
}
View Full Code Here


            EventLoopGroup eventLoopGroup = process.getEventLoop().getEventLoopGroup();

            Channel channel = NioInputStreamChannel.create(process, in);
            channel.config().setAutoRead(false);
            channel.pipeline().addLast( new DataEventHandler( process, handle ) );
            eventLoopGroup.register(channel);

            return channel.newSucceededFuture();
        }

        return null;
View Full Code Here

        // Do something which takes some amount of time

        // Register channel again on eventloop
        Channel channel = future.channel();
        group.register(channel).addListener(new ChannelFutureListener() {
            @Override
            public void operationComplete(ChannelFuture future) throws Exception {
                if (future.isSuccess()) {
                    System.out.println("Channel registered");
                } else {
View Full Code Here

    public void register(java.nio.channels.SocketChannel socket, EventLoopGroup egroup) {
        java.nio.channels.SocketChannel mySocket = socket;

        SocketChannel ch = new NioSocketChannel(mySocket);
        EventLoopGroup group = egroup;
        group.register(ch);

    }


}
View Full Code Here

                        ChannelFuture cf = ctx.deregister();
                        cf.addListener(new ChannelFutureListener() {
                            @Override
                            public void operationComplete(ChannelFuture future) throws Exception {
                                group2.register(future.channel());
                            }
                        });
                    }
                });
        ChannelFuture future = bootstrap.connect(new InetSocketAddress("www.manning.com", 80));
View Full Code Here

                    .addLast(e1, h3)
                    .addLast(e1, h4)
                    .addLast(e1, h5)
                    .addLast(e1, "recorder", h6);

            l.register(ch).sync().channel().connect(localAddr).sync();

            final LinkedList<EventType> expectedEvents = events(inbound, 8192);

            Throwable cause = new Throwable();
View Full Code Here

        // h2 will be always invoked by EventExecutor 'e1'.
        ch.pipeline().addLast(e1, h2);
        // h3 will be always invoked by EventExecutor 'e2'.
        ch.pipeline().addLast(e2, h3);

        l.register(ch).sync().channel().connect(localAddr).sync();

        // Fire inbound events from all possible starting points.
        ch.pipeline().fireChannelRead("1");
        ch.pipeline().context(h1).fireChannelRead("2");
        ch.pipeline().context(h2).fireChannelRead("3");
View Full Code Here

                         .addLast(e2, h3)
                         .addLast(e3, h4)
                         .addLast(e4, h5)
                         .addLast(e5, h6);

            l0.register(ch).sync().channel().connect(localAddr).sync();

            final int ROUNDS = 1024;
            final int ELEMS_PER_ROUNDS = 8192;
            final int TOTAL_CNT = ROUNDS * ELEMS_PER_ROUNDS;
            for (int i = 0; i < TOTAL_CNT;) {
View Full Code Here

        // Connect to the server
        final Channel cc = cb.connect(addr).syncUninterruptibly().channel();

        cc.deregister().syncUninterruptibly();
        // Change event loop group.
        group2.register(cc).syncUninterruptibly();
        cc.close().syncUninterruptibly();
        sc.close().syncUninterruptibly();
    }

    static class TestHandler extends ChannelHandlerAdapter {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.