@Override public T execute() throws KeeperException, InterruptedException { return wrapped.execute(); }
@Override public <T> T retryOperation(ZooKeeperOperation<T> operation) throws InterruptedException, KeeperException { if (isCurrentThreadEventThread()) { throw new RuntimeException("retryOperation should not be called from within the ZooKeeper event thread."); } int tryCount = 0; while (true) { tryCount++; try { return operation.execute(); } catch (KeeperException.ConnectionLossException e) { // ok } if (tryCount > 3) { log.warn("ZooKeeper operation attempt " + tryCount + " failed due to connection loss."); } waitForConnection(); } }
@Override public <T> T retryOperation(ZooKeeperOperation<T> operation) throws InterruptedException, KeeperException { if (isCurrentThreadEventThread()) { throw new RuntimeException("retryOperation should not be called from within the ZooKeeper event thread."); } int tryCount = 0; while (true) { tryCount++; try { return operation.execute(); } catch (KeeperException.ConnectionLossException e) { // ok } if (tryCount > 3) { log.warn("ZooKeeper operation attempt " + tryCount + " failed due to connection loss."); } waitForConnection(); } }