public void update(WatchedNodeUpdater<T> updater) throws InterruptedException, KeeperException { ExponentialBackoff backoff = new ExponentialBackoff(); while (true) { try { synchronized (this) { zk.setData(nodePath, encode(updater.update(value)), stat.getVersion()); } } catch (KeeperException.BadVersionException e) { // If we did not update from the latest version, backoff and retry. if (LOG.isDebugEnabled()) { LOG.debug("Did not have latest version to update node " + nodePath + ". Backing off for " + backoff.getBackoffMs() + " ms"); } backoff.backoff(); continue; } break; } }