Search in sources :

Example 1 with LoggingHandler

use of org.apache.ratis.thirdparty.io.netty.handler.logging.LoggingHandler in project incubator-ratis by apache.

the class NettyClient method connect.

/**
 * Connects to the given server address.
 */
public void connect(String serverAddress, EventLoopGroup group, ChannelInitializer<SocketChannel> initializer) throws InterruptedException {
    final InetSocketAddress address = NetUtils.createSocketAddr(serverAddress);
    lifeCycle.startAndTransition(() -> channel = new Bootstrap().group(group).channel(NioSocketChannel.class).handler(new LoggingHandler(LogLevel.INFO)).handler(initializer).connect(address).sync().channel(), InterruptedException.class);
}
Also used : NioSocketChannel(org.apache.ratis.thirdparty.io.netty.channel.socket.nio.NioSocketChannel) LoggingHandler(org.apache.ratis.thirdparty.io.netty.handler.logging.LoggingHandler) InetSocketAddress(java.net.InetSocketAddress) Bootstrap(org.apache.ratis.thirdparty.io.netty.bootstrap.Bootstrap)

Aggregations

InetSocketAddress (java.net.InetSocketAddress)1 Bootstrap (org.apache.ratis.thirdparty.io.netty.bootstrap.Bootstrap)1 NioSocketChannel (org.apache.ratis.thirdparty.io.netty.channel.socket.nio.NioSocketChannel)1 LoggingHandler (org.apache.ratis.thirdparty.io.netty.handler.logging.LoggingHandler)1