@Test public void testDeleteFailOnRetry() throws Exception { final String path = "/foo"; final int version = -1; zk.delete(path, version); EasyMock.expectLastCall().andThrow(KeeperException.create(Code.CONNECTIONLOSS)); EasyMock.expect(retry.canRetry()).andReturn(true); retry.useRetry(); EasyMock.expectLastCall().once(); retry.waitForNextAttempt(); EasyMock.expectLastCall().once(); zk.delete(path, version); EasyMock.expectLastCall().andThrow(KeeperException.create(Code.NONODE)); EasyMock.expect(retry.hasRetried()).andReturn(true); EasyMock.replay(zk, zrw, retryFactory, retry); zrw.delete(path, version); EasyMock.verify(zk, zrw, retryFactory, retry); }
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()) { 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) { retryOrThrow(retry, e); } else { throw e; } } retry.waitForNextAttempt(); } }
ZooReaderWriter extends ZooReader { 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()) { 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) { retryOrThrow(retry, e); } else { throw e; } } retry.waitForNextAttempt(); } } }
ZooReaderWriter extends ZooReader { 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()) { 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) { retryOrThrow(retry, e); } else { throw e; } } retry.waitForNextAttempt(); } } ZooReaderWriter(AccumuloConfiguration conf);  ZooReaderWriter(String keepers, int timeoutInMillis, String secret); }
ZooReaderWriter extends ZooReader { 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()) { 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) { retryOrThrow(retry, e); } else { throw e; } } retry.waitForNextAttempt(); } } ZooReaderWriter(AccumuloConfiguration conf);  ZooReaderWriter(String keepers, int timeoutInMillis, String secret); @Override ZooKeeper getZooKeeper(); List<ACL> getACL(String zPath, Stat stat); void recursiveDelete(String zPath, NodeMissingPolicy policy); boolean putPersistentData(String zPath, byte[] data, NodeExistsPolicy policy); boolean putPrivatePersistentData(String zPath, byte[] data, NodeExistsPolicy policy); boolean putPersistentData(String zPath, byte[] data, NodeExistsPolicy policy,
      List<ACL> acls); String putPersistentSequential(String zPath, byte[] data); String putEphemeralData(String zPath, byte[] data); String putEphemeralSequential(String zPath, byte[] data); void recursiveCopyPersistent(String source, String destination, NodeExistsPolicy policy); void delete(String path, int version); byte[] mutate(String zPath, byte[] createValue, List<ACL> acl, Mutator mutator); boolean isLockHeld(ZooUtil.LockID lockID); void mkdirs(String path); }
ZooReaderWriter extends ZooReader { 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()) { 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) { retryOrThrow(retry, e); } else { throw e; } } retry.waitForNextAttempt(); } } ZooReaderWriter(AccumuloConfiguration conf);  ZooReaderWriter(String keepers, int timeoutInMillis, String secret); @Override ZooKeeper getZooKeeper(); List<ACL> getACL(String zPath, Stat stat); void recursiveDelete(String zPath, NodeMissingPolicy policy); boolean putPersistentData(String zPath, byte[] data, NodeExistsPolicy policy); boolean putPrivatePersistentData(String zPath, byte[] data, NodeExistsPolicy policy); boolean putPersistentData(String zPath, byte[] data, NodeExistsPolicy policy,
      List<ACL> acls); String putPersistentSequential(String zPath, byte[] data); String putEphemeralData(String zPath, byte[] data); String putEphemeralSequential(String zPath, byte[] data); void recursiveCopyPersistent(String source, String destination, NodeExistsPolicy policy); void delete(String path, int version); byte[] mutate(String zPath, byte[] createValue, List<ACL> acl, Mutator mutator); boolean isLockHeld(ZooUtil.LockID lockID); void mkdirs(String path);  }