void closeZkClient() { _zkclient.close(); } }
protected void stopController() { stopControllerStarter(); FileUtils.deleteQuietly(new File(_controllerDataDir)); _zkClient.close(); }
@AfterClass public void tearDown() { _pinotHelixResourceManager.stop(); _zkClient.close(); ZkStarter.stopLocalZkServer(_zookeeperInstance); } }
@AfterClass public void shutDown() { _pinotHelixResourceManager.stop(); _zkClient.close(); ZkStarter.stopLocalZkServer(_zookeeperInstance); }
@AfterTest public void afterTest() { _zkClient.close(); ZkStarter.stopLocalZkServer(_zookeeperInstance); }
accessor.setProperty(keyBuilder.stateModelDef(segmentStateModelName), newStateModelDef); LOGGER.info("Completed updating statemodel {}", segmentStateModelName); zkClient.close();
@Override public void close() { if (_zkClient != null) { _zkClient.close(); } }
public synchronized void stop() { LOG.info("Stopping helixAdminWebApp"); try { _component.stop(); LOG.info("Stopped helixAdminWebApp"); } catch (Exception e) { LOG.error("Exception in stopping helixAdminWebApp", e); } finally { if (_zkClient != null) { _zkClient.close(); } if (_rawZkClient != null) { _rawZkClient.close(); } } } }
protected synchronized void close(boolean skipIfWatched) { cleanupInactiveWatchers(); if (_sharedWatchers.size() > 0) { if (skipIfWatched) { LOG.debug("Skip closing ZkConnection due to existing watchers. Watcher count {}.", _sharedWatchers.size()); return; } else { throw new HelixException( "Cannot close the connection when there are still shared watchers listen on the event."); } } super.close(); LOG.info("ZkConnection {} was closed.", _monitorKey); }
@Override public void handleDataChange(String dataPath, Object data) throws Exception { client.close(); waitCallback.countDown(); } });
@AfterClass public void afterClass() { _zkClient.close(); }
@Override public void stop() { try { _eventLock.lockInterruptibly(); if (_zkclient != null) { _zkclient.close(); _zkclient = null; } if (_eventThread == null) { LOG.warn(_eventThread + " has already stopped"); return; } LOG.debug("Stopping ZkCacheEventThread..."); _eventThread.interrupt(); _eventThread.join(2000); _eventThread = null; } catch (InterruptedException e) { LOG.error("Current thread is interrupted when stopping ZkCacheEventThread."); } finally { _eventLock.unlock(); } LOG.debug("Stop ZkCacheEventThread...done"); }
} finally { if (zkclient != null) { zkclient.close();
@Override public void close() { super.close(); if (isClosed()) { // Note that if register is not done while constructing, these private fields may not be init yet. if (_connectionManager != null) { _connectionManager.unregisterWatcher(this); } if (_onCloseCallback != null) { _onCloseCallback.onClose(); } } }
@Test public void testCloseZkClient() { String className = TestHelper.getTestClassName(); String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); ZkClient client = new ZkClient(ZK_ADDR, HelixZkClient.DEFAULT_SESSION_TIMEOUT, HelixZkClient.DEFAULT_CONNECTION_TIMEOUT, new ZNRecordSerializer()); String path = String.format("/%s", clusterName); client.createEphemeral(path); client.close(); Assert.assertFalse(_gZkClient.exists(path), "Ephemeral node: " + path + " should be removed after ZkClient#close()"); System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); }
@Test public void testZkSessionExpiry() throws Exception { String className = TestHelper.getTestClassName(); String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); ZkClient client = new ZkClient(ZK_ADDR, HelixZkClient.DEFAULT_SESSION_TIMEOUT, HelixZkClient.DEFAULT_CONNECTION_TIMEOUT, new ZNRecordSerializer()); String path = String.format("/%s", clusterName); client.createEphemeral(path); String oldSessionId = ZkTestHelper.getSessionId(client); ZkTestHelper.expireSession(client); String newSessionId = ZkTestHelper.getSessionId(client); Assert.assertNotSame(newSessionId, oldSessionId); Assert.assertFalse(client.exists(path), "Ephemeral znode should be gone after session expiry"); client.close(); System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); }
zkclient.close();
"fail to get data-delete callback after session-expiry"); client.close();
Assert.assertEquals(record.getId(), testName); zkClient.close(); TestHelper.stopZkServer(zkServer); System.out.println("END " + testName + " at " + new Date(System.currentTimeMillis()));
zkclient.close();