5858 */
5959public class TransportClientFactory implements Closeable {
6060
61+ /** A simple data structure to track the pool of clients between two peer nodes. */
6162 private class ClientPool {
6263 TransportClient [] clients ;
6364 Object [] locks ;
@@ -152,12 +153,12 @@ private TransportClient createClient(InetSocketAddress address) throws IOExcepti
152153
153154 Bootstrap bootstrap = new Bootstrap ();
154155 bootstrap .group (workerGroup )
155- .channel (socketChannelClass )
156- // Disable Nagle's Algorithm since we don't want packets to wait
157- .option (ChannelOption .TCP_NODELAY , true )
158- .option (ChannelOption .SO_KEEPALIVE , true )
159- .option (ChannelOption .CONNECT_TIMEOUT_MILLIS , conf .connectionTimeoutMs ())
160- .option (ChannelOption .ALLOCATOR , pooledAllocator );
156+ .channel (socketChannelClass )
157+ // Disable Nagle's Algorithm since we don't want packets to wait
158+ .option (ChannelOption .TCP_NODELAY , true )
159+ .option (ChannelOption .SO_KEEPALIVE , true )
160+ .option (ChannelOption .CONNECT_TIMEOUT_MILLIS , conf .connectionTimeoutMs ())
161+ .option (ChannelOption .ALLOCATOR , pooledAllocator );
161162
162163 final AtomicReference <TransportClient > clientRef = new AtomicReference <TransportClient >();
163164
@@ -174,7 +175,7 @@ public void initChannel(SocketChannel ch) {
174175 ChannelFuture cf = bootstrap .connect (address );
175176 if (!cf .awaitUninterruptibly (conf .connectionTimeoutMs ())) {
176177 throw new IOException (
177- String .format ("Connecting to %s timed out (%s ms)" , address , conf .connectionTimeoutMs ()));
178+ String .format ("Connecting to %s timed out (%s ms)" , address , conf .connectionTimeoutMs ()));
178179 } else if (cf .cause () != null ) {
179180 throw new IOException (String .format ("Failed to connect to %s" , address ), cf .cause ());
180181 }
0 commit comments