public List<String> call() { try { return transport.getZKHandle().getChildren() .inBackground((BackgroundCallback)watcher) .forPath(path); } catch (Exception e) { LOGGER.error( e.getMessage(), e); } return null; } });
private void reset() throws Exception { if ( (state.get() == State.STARTED) && isConnected.get() ) { client.checkExists().usingWatcher(watcher).inBackground(backgroundCallback).forPath(path); } }
private synchronized void readValue() throws Exception { Stat localStat = new Stat(); byte[] bytes = client.getData().storingStatIn(localStat).usingWatcher(watcher).forPath(path); stat = localStat; value = bytes; }
private void getChildren() throws Exception { BackgroundCallback callback = new BackgroundCallback() { @Override public void processResult(CuratorFramework client, CuratorEvent event) throws Exception { if ( event.getResultCode() == KeeperException.Code.OK.intValue() ) { checkLeadership(event.getChildren()); } } }; client.getChildren().inBackground(callback).forPath(latchPath); }
/** * Register Data call back for the path * * @param path */ @SuppressWarnings("restriction") public void registerDataCallBack(String path) { try { transport.getZKHandle().getData().usingWatcher(watcher).inBackground((BackgroundCallback) watcher) .forPath(path); } catch (Exception e) { LOGGER.error( "Exception in setting data call back for path :" + path , e); } }
private void deleteNode() throws Exception { String localPath = ourPath; if ( localPath != null ) { try { client.delete().guaranteed().inBackground().forPath(localPath); } finally { ourPath = null; } } } }
/** * Register callback notifications when child node added/deleted for a znode * * @param path */ @SuppressWarnings("restriction") public void registerChildrenCallback(String path) { try { transport.getZKHandle().getChildren().usingWatcher(watcher).inBackground((BackgroundCallback)watcher).forPath(path); } catch (Exception e) { LOGGER.error( "Exception while registering childrencallback for " + path, e); } }
void addFailedDelete(String path) { if ( client.isStarted() ) { log.debug("Path being added to guaranteed delete set: " + path); try { client.delete().guaranteed().inBackground().forPath(path); } catch ( Exception e ) { addFailedDelete(path); } } } }
public void deleteManualFailoverConfiguration() { try { this.curator.delete().guaranteed().inBackground().forPath(MANUAL_FAILOVER_PATH); } catch (Exception e) { throw new ZooKeeperException(e); } }
void refresh(final RefreshMode mode) throws Exception { ensurePath.ensure(client.getZookeeperClient()); final BackgroundCallback callback = new BackgroundCallback() { @Override public void processResult(CuratorFramework client, CuratorEvent event) throws Exception { processChildren(event.getChildren(), mode); } }; client.getChildren().usingWatcher(childrenWatcher).inBackground(callback).forPath(path); }
client.checkExists().usingWatcher(watcher).inBackground(callback).forPath(ZKPaths.makePath(latchPath, watchPath));