@Override public String toString() { StringBuilder sb = new StringBuilder(64); sb.append("ZooKeeperInstance: ").append(getInstanceName()).append(" ").append(getZooKeepers()); return sb.toString(); } }
private void waitForGCLock(Connector conn) throws InterruptedException { // Check if the GC process has the lock before wasting our retry attempts ZooKeeperInstance zki = (ZooKeeperInstance) conn.getInstance(); ZooCacheFactory zcf = new ZooCacheFactory(); ZooCache zcache = zcf.getZooCache(zki.getZooKeepers(), zki.getZooKeepersSessionTimeOut()); String zkPath = ZooUtil.getRoot(conn.getInstance()) + Constants.ZGC_LOCK; log.info("Looking for GC lock at {}", zkPath); byte[] data = ZooLock.getLockData(zcache, zkPath, null); while (null == data) { log.info("Waiting for GC ZooKeeper lock to be acquired"); Thread.sleep(1000); data = ZooLock.getLockData(zcache, zkPath, null); } }
@Override public String toString() { StringBuilder sb = new StringBuilder(64); sb.append("ZooKeeperInstance: ").append(getInstanceName()).append(" ").append(getZooKeepers()); return sb.toString(); } }
ZooKeeperInstance instance = new ZooKeeperInstance(zkConfig); Map<String,String> confMap = new HashMap<>(); confMap.put(DistributedTrace.TRACER_ZK_HOST, instance.getZooKeepers()); confMap.put(DistributedTrace.TRACER_ZK_PATH, ZooUtil.getRoot(instance) + Constants.ZTRACERS); confMap.put(DistributedTrace.TRACE_HOST_PROPERTY, InetAddress.getLocalHost().getHostName());