174175176177178179180181
bc.addEntry(addr, ledger, new byte[0], i, ChannelBuffers.wrappedBuffer(hello), cb, counter, 0); } counter.wait(0); System.out.println("Total = " + counter.total()); channelFactory.releaseExternalResources(); executor.shutdown(); } }
8788899091929394959697
} }); client.close(); } channelFactory.releaseExternalResources(); executor.shutdown(); } /** * Test race scenario found in {@link https://issues.apache.org/jira/browse/BOOKKEEPER-5} * where multiple clients try to connect a channel simultaneously. If not synchronised
120121122123124125126127128129130
client.connectIfNeededAndDoOp(nullop); } client.close(); } channelFactory.releaseExternalResources(); executor.shutdown(); } /** * Test that all resources are freed if connections and disconnections * are interleaved randomly.
211212213214215216217218219220221
disconnectThread.join(); checkThread.join(); assertFalse("Failure in threads, check logs", shouldFail.get()); client.close(); channelFactory.releaseExternalResources(); executor.shutdown(); } /** * Test that requests are completed even if the channel is disconnected * {@link https://issues.apache.org/jira/browse/BOOKKEEPER-668}
276277278279280281282283284285
Thread.sleep(1000); client.disconnect(); client.close(); channelFactory.releaseExternalResources(); executor.shutdown(); assertTrue("Request should have completed", completion.await(5, TimeUnit.SECONDS)); } }
276277278279280281282283
171172173174175176177178
bc.addEntry(addr, ledger, new byte[0], i, ChannelBuffers.wrappedBuffer(hello), cb, counter); } counter.wait(0); System.out.println("Total = " + counter.total()); channelFactory.releaseExternalResources(); executor.shutdown(); } }
268269270271272273274275
7475767778798081828384
107108109110111112113114
client.connectIfNeededAndDoOp(nullop); } client.close(); } channelFactory.releaseExternalResources(); executor.shutdown(); } }