AtomicLong bytesOutstanding = new AtomicLong(0);
final PerChannelBookieClient client = new PerChannelBookieClient(executor, channelFactory,
addr, bytesOutstanding);
final CountDownLatch completion = new CountDownLatch(1);
final ReadEntryCallback cb = new ReadEntryCallback() {
@Override
public void readEntryComplete(int rc, long ledgerId, long entryId,
ChannelBuffer buffer, Object ctx) {
completion.countDown();
}
};
client.connectIfNeededAndDoOp(new GenericCallback<Void>() {
@Override
public void operationComplete(final int rc, Void result) {
if (rc != BKException.Code.OK) {
executor.submitOrdered(1, new SafeRunnable() {
@Override
public void safeRun() {
cb.readEntryComplete(rc, 1, 1, null, null);
}
});
return;
}