Refine search
@Override public List<String> getChildren(String path) { try { return client.getChildren().forPath(path); } catch (NoNodeException e) { return null; } catch (Exception e) { throw new IllegalStateException(e.getMessage(), e); } }
@Override public List<String> getChildren(String path) { try { return client.getChildren().forPath(path); } catch (NoNodeException e) { return null; } catch (Exception e) { throw new IllegalStateException(e.getMessage(), e); } }
/** * Get children of a ZNode. * @param path Path of the ZNode. * @return The list of children. * @throws Exception If it cannot contact Zookeeper. */ public List<String> getChildren(final String path) throws Exception { return curator.getChildren().forPath(path); }
public List<String> list(String path) { path = "/" + path; try { if (_curator.checkExists().forPath(path) == null) { return new ArrayList<>(); } else { return _curator.getChildren().forPath(path); } } catch (Exception e) { throw new RuntimeException(e); } }
public List<String> list(String path) { path = "/" + path; try { if (_curator.checkExists().forPath(path) == null) { return new ArrayList<>(); } else { return _curator.getChildren().forPath(path); } } catch (Exception e) { throw new RuntimeException(e); } }
public Set<String> getSchemaNames() { try { Set<String> schemas = new HashSet<>(); schemas.addAll(curator.getChildren().forPath("/")); return schemas; } catch (Exception e) { throw new PrestoException(ZOOKEEPER_ERROR, "Error fetching schemas", e); } }
@Override public List<String> getChildren(String path) { try { return client.getChildren().forPath(path); } catch (KeeperException.NoNodeException e) { return null; } catch (Exception e) { throw new IllegalStateException(e.getMessage(), e); } }
@Override public List<String> getChildren(String path) { try { return client.getChildren().forPath(path); } catch (KeeperException.NoNodeException e) { return null; } catch (Exception e) { throw new IllegalStateException(e.getMessage(), e); } }
@Override public int size() { try { return curator.getChildren().forPath(mapPath).size(); } catch (Exception e) { throw new RuntimeException(e); } }
public static List<String> getTrackingJobs(Configuration conf, CuratorFramework zk) throws IOException { ArrayList<String> jobs = new ArrayList<String>(); try { for (String myid : zk.getChildren().forPath( conf.get(TempletonStorage.STORAGE_ROOT) + ZooKeeperStorage.TRACKINGDIR)) { jobs.add(myid); } } catch (Exception e) { throw new IOException("Can't get tracking children", e); } return jobs; } }
public List<TaskAnnouncement> getAnnouncements() throws Exception { final List<TaskAnnouncement> announcements = new ArrayList<>(); for (String id : curatorFramework.getChildren().forPath(getStatusPathForWorker())) { announcements.add( jsonMapper.readValue( curatorFramework.getData().forPath(getStatusPathForId(id)), TaskAnnouncement.class ) ); } return announcements; }
@Override public boolean isEmpty() { try { return curator.getChildren().forPath(mapPath).isEmpty(); } catch (Exception e) { throw new ZKException(e); } }
@Override public List<String> getChildrenKeys(final String key) { try { List<String> result = client.getChildren().forPath(key); Collections.sort(result, new Comparator<String>() { @Override public int compare(final String o1, final String o2) { return o2.compareTo(o1); } }); return result; // CHECKSTYLE:OFF } catch (final Exception ex) { // CHECKSTYLE:ON CuratorZookeeperExceptionHandler.handleException(ex); return Collections.emptyList(); } }
@Override public List<String> getAllForType(Type type) { try { return zk.getChildren().forPath(getPath(type)); } catch (Exception e) { return new ArrayList<String>(); } }
protected List<String> addTargetChildListener(String path, PathChildrenListener listener) { try { listener.startListener(); return client.getChildren().forPath(path); } catch (KeeperException.NoNodeException e) { return null; } catch (Exception e) { throw new IllegalStateException(e.getMessage(), e); } }
protected List<String> addTargetChildListener(String path, PathChildrenListener listener) { try { listener.startListener(); return client.getChildren().forPath(path); } catch (KeeperException.NoNodeException e) { return null; } catch (Exception e) { throw new IllegalStateException(e.getMessage(), e); } }
@Override public Object call() throws Exception { try { return curatorWithSuperAuth().getChildren().forPath("/"); } catch (Exception e) { return null; } } });
@Override public Object call() throws Exception { try { curatorWithSuperAuth().getChildren().forPath("/"); return null; } catch (KeeperException.ConnectionLossException e) { return true; } catch (Exception e) { return null; } } });
@VisibleForTesting protected List<String> getChildren(String path) throws Exception { return exhibitor.getLocalConnection().getChildren().forPath(path); }
private static Map<TopicPartition, OffsetAndMetadata> getOffsetsAtPath( CuratorFramework curator, ObjectMapper objectMapper, String partitionsRoot) throws Exception { Map<TopicPartition, OffsetAndMetadata> offsets = new HashMap<>(); if (curator.checkExists().forPath(partitionsRoot) == null) { throw new RuntimeException("No such path " + partitionsRoot); } List<String> partitionPaths = curator.getChildren().forPath(partitionsRoot); for (String partitionPath : partitionPaths) { String absPartitionPath = partitionsRoot + "/" + partitionPath; LOG.info("Reading offset data from path {}", absPartitionPath); byte[] partitionBytes = curator.getData().forPath(absPartitionPath); Map<String, Object> partitionMetadata = objectMapper.readValue(partitionBytes, new TypeReference<Map<String, Object>>() { }); String topic = (String) partitionMetadata.get("topic"); int partition = ((Number) partitionMetadata.get("partition")).intValue(); long offset = ((Number) partitionMetadata.get("offset")).longValue(); offsets.put(new TopicPartition(topic, partition), new OffsetAndMetadata(offset)); } return offsets; }