ClientBootstrap bootstrap = new ClientBootstrap(channelFactory);
bootstrap.setPipelineFactory(this);
bootstrap.setOption("tcpNoDelay", conf.getClientTcpNoDelay());
bootstrap.setOption("keepAlive", true);
ChannelFuture future = bootstrap.connect(addr);
future.addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) throws Exception {
int rc;
Queue<GenericCallback<Void>> oldPendingOps;
synchronized (PerChannelBookieClient.this) {
if (future.isSuccess()) {
LOG.info("Successfully connected to bookie: " + addr);
rc = BKException.Code.OK;
channel = future.getChannel();
state = ConnectionState.CONNECTED;
} else {
LOG.error("Could not connect to bookie: " + addr);
rc = BKException.Code.BookieHandleNotAvailableException;
channel = null;