Package org.apache.curator.utils
Class EnsurePath
- java.lang.Object
-
- org.apache.curator.utils.EnsurePath
-
@Deprecated public class EnsurePath extends java.lang.ObjectDeprecated.Since 2.9.0 - Prefer CuratorFramework.create().creatingParentContainersIfNeeded() or CuratorFramework.exists().creatingParentContainersIfNeeded()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, ...);
-
-
Constructor Summary
Constructors Modifier Constructor Description EnsurePath(java.lang.String path)Deprecated.protectedEnsurePath(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.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected booleanasContainers()Deprecated.voidensure(CuratorZookeeperClient client)Deprecated.First time, synchronizes and makes sure all nodes in the path are created.EnsurePathexcludingLast()Deprecated.Returns a view of this EnsurePath instance that does not make the last node.java.lang.StringgetPath()Deprecated.Returns the path being Ensured
-
-
-
Constructor Detail
-
EnsurePath
public EnsurePath(java.lang.String path)
Deprecated.- Parameters:
path- the full path to ensure
-
EnsurePath
public EnsurePath(java.lang.String path, InternalACLProvider aclProvider)Deprecated.- Parameters:
path- the full path to ensureaclProvider- if not null, the ACL provider to use when creating parent nodes
-
EnsurePath
protected EnsurePath(java.lang.String path, java.util.concurrent.atomic.AtomicReference<org.apache.curator.utils.EnsurePath.Helper> helper, boolean makeLastNode, InternalACLProvider aclProvider)Deprecated.
-
-
Method Detail
-
ensure
public void ensure(CuratorZookeeperClient client) throws java.lang.Exception
Deprecated.First time, synchronizes and makes sure all nodes in the path are created. Subsequent calls with this instance are NOPs.- Parameters:
client- ZK client- Throws:
java.lang.Exception- ZK errors
-
excludingLast
public EnsurePath excludingLast()
Deprecated.Returns a view of this EnsurePath instance that does not make the last node. i.e. if the path is "/a/b/c" only "/a/b" will be ensured- Returns:
- view
-
getPath
public java.lang.String getPath()
Deprecated.Returns the path being Ensured- Returns:
- the path being ensured
-
asContainers
protected boolean asContainers()
Deprecated.
-
-