@Override public void register(final CuratorTransaction transaction) throws Exception { for (final String path : paths) { transaction.delete().forPath(path); } }
@Override public void register(final CuratorTransaction transaction) throws Exception { transaction.delete().forPath(path); }
for (String parent : parentsIBuilt) { try { transaction = transaction.delete().forPath(parent).and();
/** * Unannounces an announcement created at path. Note that if all announcements get removed, the Announcer * will continue to have ZK watches on paths because clearing them out is a source of ugly race conditions. * <p/> * If you need to completely clear all the state of what is being watched and announced, stop() the Announcer. * * @param path the path to unannounce */ public void unannounce(String path) { log.info("unannouncing [%s]", path); final ZKPaths.PathAndNode pathAndNode = ZKPaths.getPathAndNode(path); final String parentPath = pathAndNode.getPath(); final ConcurrentMap<String, byte[]> subPaths = announcements.get(parentPath); if (subPaths == null || subPaths.remove(pathAndNode.getNode()) == null) { log.error("Path[%s] not announced, cannot unannounce.", path); return; } try { curator.inTransaction().delete().forPath(path).and().commit(); } catch (KeeperException.NoNodeException e) { log.info("node[%s] didn't exist anyway...", path); } catch (Exception e) { throw Throwables.propagate(e); } }
@Override public void register(final CuratorTransaction transaction) throws Exception { for (final String path : paths) { transaction.delete().forPath(path); } }
@Override public void register(final CuratorTransaction transaction) throws Exception { transaction.delete().forPath(path); }
@Override public TransactionDeleteBuilder delete() { return new TransactionDeleteBuilderDecorator(inner.delete()); }
@Override public CuratorTransaction and(CuratorTransaction transaction) throws Exception { return transaction.delete().forPath(path).and(); }
/** * Build a transaction to atomically delete a directory tree. Package private for testing. * * @param zkClient connection to ZooKeeper. * @param tx recursive transaction being built up. * @param path current directory to delete. * @return a transaction to delete the directory tree. * @throws Exception on unrecoverable ZooKeeper error. */ static CuratorTransactionFinal buildAtomicRecursiveDelete( final CuratorFramework zkClient, final CuratorTransaction tx, final String path ) throws Exception { final List<String> children = zkClient.getChildren().forPath(path); for (String child : children) { buildAtomicRecursiveDelete(zkClient, tx, path + "/" + child); } return tx.delete().forPath(path).and(); }
@Override public void applyMigration() { try { for (String service : baragonStateDatastore.getServices()) { Collection<String> upstreams = curatorFramework.getChildren().forPath(ZKPaths.makePath(BaragonStateDatastore.SERVICES_FORMAT, service)); for (String upstream : upstreams) { Optional<UpstreamInfo> maybeUpstream = baragonStateDatastore.getUpstreamInfo(service, upstream); UpstreamInfo mergedInfo; if (maybeUpstream.isPresent()) { UpstreamInfo fromPath = UpstreamInfo.fromString(upstream); mergedInfo = new UpstreamInfo(fromPath.getUpstream(), maybeUpstream.get().getRequestId().or(fromPath.getRequestId()), maybeUpstream.get().getRackId().or(fromPath.getRackId())); } else { mergedInfo = UpstreamInfo.fromString(upstream); } curatorFramework.inTransaction() .delete().forPath(String.format(BaragonStateDatastore.UPSTREAM_FORMAT, service, upstream)).and() .create().forPath(String.format(BaragonStateDatastore.UPSTREAM_FORMAT, service, mergedInfo.toPath())).and() .commit(); } } } catch (Exception e) { Throwables.propagate(e); } } }
for (String parent : parentsIBuilt) { try { transaction = transaction.delete().forPath(parent).and();
for (String parent : parentsIBuilt) { try { transaction = transaction.delete().forPath(parent).and();
/** * Unannounces an announcement created at path. Note that if all announcements get removed, the Announcer * will continue to have ZK watches on paths because clearing them out is a source of ugly race conditions. * <p/> * If you need to completely clear all the state of what is being watched and announced, stop() the Announcer. * * @param path the path to unannounce */ public void unannounce(String path) { log.info("unannouncing [%s]", path); final ZKPaths.PathAndNode pathAndNode = ZKPaths.getPathAndNode(path); final String parentPath = pathAndNode.getPath(); final ConcurrentMap<String, byte[]> subPaths = announcements.get(parentPath); if (subPaths == null || subPaths.remove(pathAndNode.getNode()) == null) { log.error("Path[%s] not announced, cannot unannounce.", path); return; } try { curator.inTransaction().delete().forPath(path).and().commit(); } catch (KeeperException.NoNodeException e) { log.info("node[%s] didn't exist anyway...", path); } catch (Exception e) { throw Throwables.propagate(e); } }
/** * Unannounces an announcement created at path. Note that if all announcements get removed, the Announcer * will continue to have ZK watches on paths because clearing them out is a source of ugly race conditions. * <p/> * If you need to completely clear all the state of what is being watched and announced, stop() the Announcer. * * @param path the path to unannounce */ public void unannounce(String path) { log.info("unannouncing [%s]", path); final ZKPaths.PathAndNode pathAndNode = ZKPaths.getPathAndNode(path); final String parentPath = pathAndNode.getPath(); final ConcurrentMap<String, byte[]> subPaths = announcements.get(parentPath); if (subPaths == null || subPaths.remove(pathAndNode.getNode()) == null) { log.error("Path[%s] not announced, cannot unannounce.", path); return; } try { curator.inTransaction().delete().forPath(path).and().commit(); } catch (KeeperException.NoNodeException e) { log.info("node[%s] didn't exist anyway...", path); } catch (Exception e) { throw Throwables.propagate(e); } }
.delete().forPath(itemPath) .and() .create().withMode(CreateMode.PERSISTENT_SEQUENTIAL).forPath(makeRequeueItemPath(itemPath), bytes)