Skip to content

Latest commit

 

History

History
38 lines (30 loc) · 1.21 KB

README.md

File metadata and controls

38 lines (30 loc) · 1.21 KB

netty-xnio-transport

This is a Netty Transport powered by XNIO. It can be used to either wrap an existing StreamConnection and AcceptingChannel or to bootstrap a Netty powered server directly.

To bootstrap a server use it the same way as other transport implementations. The following code snipped shows an example:

    public void run() throws Exception {
        // Configure the server.
        EventLoopGroup group = new XnioEventLoopGroup(4);
        try {
            ServerBootstrap b = new ServerBootstrap();
            b.group(group)
             .childHandler(new HelloServerInitializer())

             .channel(XnioServerSocketChannel.class)
             .option(XnioChannelOption.BALANCING_TOKENS, 1)
             .option(XnioChannelOption.BALANCING_CONNECTIONS, 2)
             .childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
            Channel ch = b.bind(port).sync().channel();
            ch.closeFuture().sync();
        } finally {
            group.shutdownGracefully().sync();
        }
    }

The branch 0.1.x is there to support Java 8.

Releasing

    mvn release:prepare -Pjboss-release
    mvn release:perform -Pjboss-release