@Override public List<String> getMasterLocations() { String masterLocPath = ZooUtil.getRoot(getInstanceID()) + Constants.ZMASTER_LOCK; OpTimer timer = null; if (log.isTraceEnabled()) { log.trace("tid={} Looking up master location in zookeeper.", Thread.currentThread().getId()); timer = new OpTimer().start(); } byte[] loc = ZooUtil.getLockData(zooCache, masterLocPath); if (timer != null) { timer.stop(); log.trace("tid={} Found master at {} in {}", Thread.currentThread().getId(), (loc == null ? "null" : new String(loc, UTF_8)), String.format("%.3f secs", timer.scale(TimeUnit.SECONDS))); } if (loc == null) { return Collections.emptyList(); } return Collections.singletonList(new String(loc, UTF_8)); }
/** * Returns the location(s) of the accumulo master and any redundant servers. * * @return a list of locations in "hostname:port" form */ public List<String> getMasterLocations() { ensureOpen(); String masterLocPath = getZooKeeperRoot() + Constants.ZMASTER_LOCK; OpTimer timer = null; if (log.isTraceEnabled()) { log.trace("tid={} Looking up master location in zookeeper.", Thread.currentThread().getId()); timer = new OpTimer().start(); } byte[] loc = ZooUtil.getLockData(zooCache, masterLocPath); if (timer != null) { timer.stop(); log.trace("tid={} Found master at {} in {}", Thread.currentThread().getId(), (loc == null ? "null" : new String(loc, UTF_8)), String.format("%.3f secs", timer.scale(TimeUnit.SECONDS))); } if (loc == null) { return Collections.emptyList(); } return Collections.singletonList(new String(loc, UTF_8)); }
for (String tserver : zc.getChildren(context.getZooKeeperRoot() + Constants.ZTSERVERS)) { String path = context.getZooKeeperRoot() + Constants.ZTSERVERS + "/" + tserver; byte[] data = ZooUtil.getLockData(zc, path); if (data != null) { String strData = new String(data, UTF_8);