@Deprecated
public class EnsurePath
extends java.lang.Object
Utility to ensure that a particular path is created.
The first time it is used, a synchronized call to ZKPaths.mkdirs(ZooKeeper, String)
is made to
ensure that the entire path has been created (with an empty byte array if needed). Subsequent
calls with the instance are un-synchronized NOPs.
Usage:
EnsurePath ensurePath = new EnsurePath(aFullPathToEnsure); ... String nodePath = aFullPathToEnsure + "/foo"; ensurePath.ensure(zk); // first time syncs and creates if needed zk.create(nodePath, ...); ... ensurePath.ensure(zk); // subsequent times are NOPs zk.create(nodePath, ...);
Modifier | Constructor | Description |
---|---|---|
|
EnsurePath(java.lang.String path) |
Deprecated.
|
protected |
EnsurePath(java.lang.String path,
java.util.concurrent.atomic.AtomicReference<org.apache.curator.utils.EnsurePath.Helper> helper,
boolean makeLastNode,
InternalACLProvider aclProvider) |
Deprecated.
|
|
EnsurePath(java.lang.String path,
InternalACLProvider aclProvider) |
Deprecated.
|
Modifier and Type | Method | Description |
---|---|---|
protected boolean |
asContainers() |
Deprecated.
|
void |
ensure(CuratorZookeeperClient client) |
Deprecated.
First time, synchronizes and makes sure all nodes in the path are created.
|
EnsurePath |
excludingLast() |
Deprecated.
Returns a view of this EnsurePath instance that does not make the last node.
|
java.lang.String |
getPath() |
Deprecated.
Returns the path being Ensured
|
public EnsurePath(java.lang.String path)
path
- the full path to ensurepublic EnsurePath(java.lang.String path, InternalACLProvider aclProvider)
path
- the full path to ensureaclProvider
- if not null, the ACL provider to use when creating parent nodesprotected EnsurePath(java.lang.String path, java.util.concurrent.atomic.AtomicReference<org.apache.curator.utils.EnsurePath.Helper> helper, boolean makeLastNode, InternalACLProvider aclProvider)
public void ensure(CuratorZookeeperClient client) throws java.lang.Exception
client
- ZK clientjava.lang.Exception
- ZK errorspublic EnsurePath excludingLast()
public java.lang.String getPath()
protected boolean asContainers()
Copyright © 2011–2018 The Apache Software Foundation. All rights reserved.