/** * Tells if a given operation exception can be retried or not. * @param t The exception raised by an operation. * @return {@code true} if the operation can be retried. */ public static boolean canRetry(Throwable t) { return t instanceof KeeperException && canRetry(((KeeperException) t).code()); }
@Override public void onFailure(Throwable t) { if (RetryUtils.canRetry(t)) { exists(); } else { lastResult.set(null, false); LOG.error("Fail to re-set watch on exists for path " + path, t); } } });
@Override public void onFailure(Throwable t) { if (RetryUtils.canRetry(t)) { exists(); } else { lastResult.set(null, false); LOG.error("Fail to re-set watch on exists for path " + path, t); } } });
/** * Tells if a given operation exception can be retried or not. * @param t The exception raised by an operation. * @return {@code true} if the operation can be retried. */ public static boolean canRetry(Throwable t) { return t instanceof KeeperException && canRetry(((KeeperException) t).code()); }
private boolean doRetry(Throwable t) { if (!RetryUtils.canRetry(t)) { return false; } // Determine the relay delay long nextRetry = retryStrategy.nextRetry(failureCount.incrementAndGet(), startTime, type, path); if (nextRetry < 0) { return false; } // Schedule the retry. SCHEDULER.schedule(new Runnable() { @Override public void run() { Futures.addCallback(retryAction.get(), OperationFutureCallback.this); } }, nextRetry, TimeUnit.MILLISECONDS); return true; } }
private boolean doRetry(Throwable t) { if (!RetryUtils.canRetry(t)) { return false; } // Determine the relay delay long nextRetry = retryStrategy.nextRetry(failureCount.incrementAndGet(), startTime, type, path); if (nextRetry < 0) { return false; } // Schedule the retry. SCHEDULER.schedule(new Runnable() { @Override public void run() { Futures.addCallback(retryAction.get(), OperationFutureCallback.this); } }, nextRetry, TimeUnit.MILLISECONDS); return true; } }
@Override public void onFailure(Throwable t) { if (RetryUtils.canRetry(t)) { data(); return; } lastResult.set(null, false); if (t instanceof KeeperException) { KeeperException.Code code = ((KeeperException) t).code(); if (code == KeeperException.Code.NONODE) { // Node deleted process(new WatchedEvent(Event.EventType.NodeDeleted, Event.KeeperState.SyncConnected, path)); return; } } LOG.error("Fail to re-set watch on getData for path " + path, t); } });
@Override public void onFailure(Throwable t) { if (RetryUtils.canRetry(t)) { data(); return; } lastResult.set(null, false); if (t instanceof KeeperException) { KeeperException.Code code = ((KeeperException) t).code(); if (code == KeeperException.Code.NONODE) { // Node deleted process(new WatchedEvent(Event.EventType.NodeDeleted, Event.KeeperState.SyncConnected, path)); return; } } LOG.error("Fail to re-set watch on getData for path " + path, t); } });
@Override public void onFailure(Throwable t) { if (RetryUtils.canRetry(t)) { children(); return; } lastResult.set(null, false); if (t instanceof KeeperException) { KeeperException.Code code = ((KeeperException) t).code(); if (code == KeeperException.Code.NONODE) { // Node deleted process(new WatchedEvent(Event.EventType.NodeDeleted, Event.KeeperState.SyncConnected, path)); return; } } LOG.error("Fail to re-set watch on getChildren for path " + path, t); } });
@Override public void onFailure(Throwable t) { if (RetryUtils.canRetry(t)) { children(); return; } lastResult.set(null, false); if (t instanceof KeeperException) { KeeperException.Code code = ((KeeperException) t).code(); if (code == KeeperException.Code.NONODE) { // Node deleted process(new WatchedEvent(Event.EventType.NodeDeleted, Event.KeeperState.SyncConnected, path)); return; } } LOG.error("Fail to re-set watch on getChildren for path " + path, t); } });