public Object getData(String path) { path = "/" + path; try { if(_curator.checkExists().forPath(path)!=null) { return _des.deserializeObject(_curator.getData().forPath(path)); } else { return null; } } catch(Exception e) { throw new RuntimeException(e); } }
public byte[] getData(CuratorFramework zk, String path, boolean watch) throws Exception { String npath = PathUtils.normalize_path(path); try { if (existsNode(zk, npath, watch)) { if (watch) { return zk.getData().watched().forPath(npath); } else { return zk.getData().forPath(npath); } } } catch (KeeperException e) { LOG.error("zookeeper getdata for path" + path, e); } return null; }
private void checkRevocableWatcher(String path) throws Exception { RevocationSpec entry = revocable.get(); if ( entry != null ) { try { byte[] bytes = client.getData().usingWatcher(revocableWatcher).forPath(path); if ( Arrays.equals(bytes, REVOKE_MESSAGE) ) { entry.getExecutor().execute(entry.getRunnable()); } } catch ( KeeperException.NoNodeException ignore ) { // ignore } } }
client.getData().decompressed().usingWatcher(dataWatcher).inBackground(getDataCallback).forPath(fullPath); client.getData().usingWatcher(dataWatcher).inBackground(getDataCallback).forPath(fullPath);
private void internalRebuild() throws Exception { try { Stat stat = new Stat(); byte[] bytes = dataIsCompressed ? client.getData().decompressed().storingStatIn(stat).forPath(path) : client.getData().storingStatIn(stat).forPath(path); data.set(new ChildData(path, stat, bytes)); } catch ( KeeperException.NoNodeException e ) { data.set(null); } }
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 watchPathDataChange(String path) throws Exception { this.client.getData().usingWatcher(getPathWatcher()).forPath(path); }
client.getData().decompressed().usingWatcher(watcher).inBackground(backgroundCallback).forPath(path); client.getData().usingWatcher(watcher).inBackground(backgroundCallback).forPath(path);
private void internalRebuildNode(String fullPath) throws Exception { if ( cacheData ) { try { Stat stat = new Stat(); byte[] bytes = dataIsCompressed ? client.getData().decompressed().storingStatIn(stat).forPath(fullPath) : client.getData().storingStatIn(stat).forPath(fullPath); currentData.put(fullPath, new ChildData(fullPath, stat, bytes)); } catch ( KeeperException.NoNodeException ignore ) { // node no longer exists - remove it currentData.remove(fullPath); } } else { Stat stat = client.checkExists().forPath(fullPath); if ( stat != null ) { currentData.put(fullPath, new ChildData(fullPath, stat, null)); } else { // node no longer exists - remove it currentData.remove(fullPath); } } }
private boolean getCurrentValue(MutableAtomicValue<byte[]> result, Stat stat) throws Exception { boolean createIt = false; try { ensurePath.ensure(client.getZookeeperClient()); result.preValue = client.getData().storingStatIn(stat).forPath(path); } catch ( KeeperException.NoNodeException e ) { result.preValue = null; createIt = true; } return createIt; }
@Override public byte[] call() throws Exception { return zk.getData().forPath(buildZookeeperPath(pathSuffix)); } });
/** * 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); } }
if ( type == ProcessType.NORMAL ) bytes = client.getData().storingStatIn(stat).forPath(itemPath);
private void loadData(String path) throws Exception { GetDataBuilder getDataBuilder = client.getData(); String key = getKeyFromNodePath(path); byte[] data = getDataBuilder.forPath(path); String value = new String(data, Charsets.UTF_8); this.config.put(key, value); }
public byte[] getMemberData(String path){ try{ if(transport.getZKHandle().checkExists().usingWatcher(watcher).forPath(path) != null){ byte[] data = transport.getZKHandle().getData().usingWatcher(watcher).forPath(path); return data; } }catch(Exception e){ LOGGER.error( "Exception while fetching data for " + path, e); } return null; }
private static Participant participantForPath(CuratorFramework client, String path, boolean markAsLeader) throws Exception { byte[] bytes = client.getData().forPath(path); String thisId = new String(bytes, "UTF-8"); return new Participant(thisId, markAsLeader); }
client.getData().usingWatcher(revocableWatcher).forPath(ourPath);
public byte[] readBytes(String path) { try { if (!exists(path)) return null; return m_curator.getData().forPath(path); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } }
byte[] nodedata = getZKHandle().getData().usingWatcher(this) .forPath(path); ZooKeeperDataWrapper datawrapper = getWrapper(nodedata);
@Override public byte[] getData() throws Exception { return internals.getClient().getData().forPath(path); } };