public void delete(String path) throws Exception { transactionFinal = transactionFinal.delete().forPath(path).and(); }
@Override public void execute(final CuratorTransactionFinal curatorTransactionFinal) throws Exception { for (Map.Entry<JobInstance, List<Integer>> entry : shardingResults.entrySet()) { for (int shardingItem : entry.getValue()) { curatorTransactionFinal.create().forPath(jobNodePath.getFullPath(ShardingNode.getInstanceNode(shardingItem)), entry.getKey().getJobInstanceId().getBytes()).and(); } } curatorTransactionFinal.delete().forPath(jobNodePath.getFullPath(ShardingNode.NECESSARY)).and(); curatorTransactionFinal.delete().forPath(jobNodePath.getFullPath(ShardingNode.PROCESSING)).and(); } }
public void commit() throws Exception { transactionFinal = transactionFinal.delete() .forPath(fencingNodePath).and(); transactionFinal.commit(); }
@Override public void deleteRecursive(final String path) throws KeeperException { assertClusterIdFlagTrue(); try { final List<String> nodes = listRecursive(path); if (nodes.isEmpty()) { return; } final CuratorTransactionFinal t = client.inTransaction().check().forPath(path).and(); for (final String node : reverse(nodes)) { t.delete().forPath(node).and(); } t.commit(); } catch (Exception e) { throwIfInstanceOf(e, KeeperException.class); throw new RuntimeException(e); } }
@Override public TransactionDeleteBuilder delete() { return new TransactionDeleteBuilderDecorator(inner.delete()); }
@Override public void execute(final CuratorTransactionFinal curatorTransactionFinal) throws Exception { curatorTransactionFinal.delete().forPath(jobNodePath.getFullPath(ScheduleNode.NECESSARY)).and(); curatorTransactionFinal.delete().forPath(jobNodePath.getFullPath(ScheduleNode.SCHEDULING)).and(); } }
curatorTransactionFinal = curatorTransactionFinal.delete().forPath(childPath).and(); pendingDeletePaths.add(childPath);
@Override public void execute(final CuratorTransactionFinal curatorTransactionFinal) throws Exception { for (Map.Entry<JobInstance, List<Integer>> entry : shardingResults.entrySet()) { for (int shardingItem : entry.getValue()) { curatorTransactionFinal.create().forPath(jobNodePath.getFullPath(ShardingNode.getInstanceNode(shardingItem)), entry.getKey().getJobInstanceId().getBytes()).and(); } } curatorTransactionFinal.delete().forPath(jobNodePath.getFullPath(ShardingNode.NECESSARY)).and(); curatorTransactionFinal.delete().forPath(jobNodePath.getFullPath(ShardingNode.PROCESSING)).and(); } }
public CuratorTransactionFinal build( CuratorFramework client, String serviceRootPath ) throws Exception { // List of paths which are about to be deleted by the transaction Set<String> pendingDeletePaths = new HashSet<>(); CuratorTransactionFinal transaction = client .inTransaction() .check() .forPath(serviceRootPath) .and(); for (String path : pathsToClear) { // if present, delete path and any children (unless already being deleted) if (!pendingDeletePaths.contains(path) && client.checkExists().forPath(path) != null) { transaction = deleteChildrenOf(client, path, transaction, pendingDeletePaths) .delete().forPath(path).and(); pendingDeletePaths.add(path); } } return transaction; } }
@Override public void execute(final CuratorTransactionFinal curatorTransactionFinal) throws Exception { for (Map.Entry<JobInstance, List<Integer>> entry : shardingResults.entrySet()) { for (int shardingItem : entry.getValue()) { curatorTransactionFinal.create().forPath(jobNodePath.getFullPath(ShardingNode.getInstanceNode(shardingItem)), entry.getKey().getJobInstanceId().getBytes()).and(); } } curatorTransactionFinal.delete().forPath(jobNodePath.getFullPath(ShardingNode.NECESSARY)).and(); curatorTransactionFinal.delete().forPath(jobNodePath.getFullPath(ShardingNode.PROCESSING)).and(); } }
@Override public void deleteRecursive(final String path) throws KeeperException { assertClusterIdFlagTrue(); try { final List<String> nodes = listRecursive(path); if (nodes.isEmpty()) { return; } final CuratorTransactionFinal t = client.inTransaction().check().forPath(path).and(); for (final String node : reverse(nodes)) { t.delete().forPath(node).and(); } t.commit(); } catch (Exception e) { propagateIfInstanceOf(e, KeeperException.class); throw propagate(e); } }
.delete().forPath(childPath).and();
LOG.info("Deleting {}", fullPath); pathsToDelete.add(fullPath); transaction.delete().forPath(fullPath).and(); LOG.info("Deleting {}", fullPath); pathsToDelete.add(fullPath); transaction.delete().forPath(fullPath).and(); LOG.info("Deleting {}", fullPath); pathsToDelete.add(fullPath); transaction.delete().forPath(fullPath).and();