/** * sync getChildNames * * @return null if parentPath doesn't exist */ @Override public List<String> getChildNames(String parentPath, int options) { try { List<String> childNames = _zkClient.getChildren(parentPath); Collections.sort(childNames); return childNames; } catch (ZkNoNodeException e) { return null; } }
@SuppressWarnings("unchecked") private Element<T> getFirstElement() { try { while (true) { List<String> list = _zkClient.getChildren(_root); if (list.size() == 0) { return null; } String elementName = getSmallestElement(list); try { return new Element<T>( _root + "/" + elementName, (T) _zkClient.readData(_root + "/" + elementName)); } catch (ZkNoNodeException e) { // somebody else picked up the element first, so we have to // retry with the new first element } } } catch (Exception e) { throw ExceptionUtil.convertToRuntimeException(e); } }
public boolean isEmpty() { return _zkClient.getChildren(_root).size() == 0; }