@Override public void delete(String path, int version) throws InterruptedException, KeeperException { final Retry retry = getRetryFactory().createRetry(); while (true) { try { getZooKeeper().delete(path, version); return; } catch (KeeperException e) { final Code code = e.code(); if (code == Code.NONODE) { if (retry.hasRetried()) { // A retried delete could have deleted the node, assume that was the case log.debug("Delete saw no node on a retry. Assuming node was deleted"); return; } throw e; } else if (code == Code.CONNECTIONLOSS || code == Code.OPERATIONTIMEOUT || code == Code.SESSIONEXPIRED) { // retry if we have more attempts to do so retryOrThrow(retry, e); } else { throw e; } } retry.waitForNextAttempt(); } }
if (createValue != null) { while (true) { final Retry retry = getRetryFactory().createRetry(); try { getZooKeeper().create(zPath, createValue, acl, CreateMode.PERSISTENT); final Retry retry = getRetryFactory().createRetry(); Stat stat = new Stat(); byte[] data = getData(zPath, false, stat);
@Override public void delete(String path, int version) throws InterruptedException, KeeperException { final Retry retry = getRetryFactory().createRetry(); while (true) { try { getZooKeeper().delete(path, version); return; } catch (KeeperException e) { final Code code = e.code(); if (code == Code.NONODE) { if (retry.hasRetried()) { // A retried delete could have deleted the node, assume that was the case log.debug("Delete saw no node on a retry. Assuming node was deleted"); return; } throw e; } else if (code == Code.CONNECTIONLOSS || code == Code.OPERATIONTIMEOUT || code == Code.SESSIONEXPIRED) { // retry if we have more attempts to do so retryOrThrow(retry, e); } else { throw e; } } retry.waitForNextAttempt(); } }
if (createValue != null) { while (true) { final Retry retry = getRetryFactory().createRetry(); try { getZooKeeper().create(zPath, createValue, acl, CreateMode.PERSISTENT); final Retry retry = getRetryFactory().createRetry(); Stat stat = new Stat(); byte[] data = getData(zPath, false, stat);