private class Update implements Reactor.Callback {
@Override
public void run(final boolean timeout) throws InterruptedException {
final RetryScheduler retryScheduler = BoundedRandomExponentialBackoff.newBuilder()
.setMinInterval(1, SECONDS)
.setMaxInterval(30, SECONDS)
.build()
.newScheduler();
while (isAlive()) {
try {
if (!parentExists()) {
log.warn("parent does not exist: {}", path);
return;
}
if (!initialized) {
syncChecked();
initialized = true;
}
incrementalUpdate();
return;
} catch (KeeperException e) {
final long backoff = retryScheduler.nextMillis();
initialized = false;
if (e instanceof ConnectionLossException) {
log.warn("Connection lost. Resyncing in {}ms", backoff);
} else if (e instanceof NodeExistsException || e instanceof NoNodeException) {
log.warn("Conflict: {} {}. Resyncing in {}ms", e.getPath(), e.code(), backoff);