MCPcopy Create free account
hub / github.com/OpenTSDB/asynchbase / disconnectZK

Method disconnectZK

src/HBaseClient.java:4275–4299  ·  view source on GitHub ↗

Disconnects from ZooKeeper. This method is blocking. Unfortunately, ZooKeeper doesn't offer an asynchronous API to close a session at this time. It waits until the server responds to the closeSession RPC.

()

Source from the content-addressed store, hash-verified

4273 * It waits until the server responds to the {@code closeSession} RPC.
4274 */
4275 public void disconnectZK() {
4276 synchronized (this) {
4277 if (zk == null) {
4278 return;
4279 }
4280 try {
4281 // I'm not sure but I think both the client and the server race to
4282 // close the socket, which often causes the DEBUG spam:
4283 // java.net.SocketException: Socket is not connected
4284 // When the client attempts to close its socket after its OS and
4285 // JVM are done processing the TCP FIN and it's already closed.
4286 LOG.debug("Ignore any DEBUG exception from ZooKeeper");
4287 final long start = System.nanoTime();
4288 zk.close();
4289 LOG.debug("ZooKeeper#close completed in {}ns",
4290 System.nanoTime() - start);
4291 } catch (InterruptedException e) {
4292 // The signature of the method pretends that it can throw an
4293 // InterruptedException, but this is a lie, the code of that
4294 // method will never throw this type of exception.
4295 LOG.error("Should never happen", e);
4296 }
4297 zk = null;
4298 }
4299 }
4300
4301 /** Schedule a timer to retry {@link #getRootRegion} after some time. */
4302 private void retryGetRootRegionLater() {

Callers 3

processMethod · 0.95
callMethod · 0.45
processResultMethod · 0.45

Calls 1

closeMethod · 0.80

Tested by

no test coverage detected