|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.curator.utils.EnsurePath
public class EnsurePath
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 | |
---|---|
EnsurePath(String path)
|
|
EnsurePath(String path,
InternalACLProvider aclProvider)
|
Method Summary | |
---|---|
void |
ensure(CuratorZookeeperClient client)
First time, synchronizes and makes sure all nodes in the path are created. |
EnsurePath |
excludingLast()
Returns a view of this EnsurePath instance that does not make the last node. |
String |
getPath()
Returns the path being Ensured |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EnsurePath(String path)
path
- the full path to ensurepublic EnsurePath(String path, InternalACLProvider aclProvider)
path
- the full path to ensureaclProvider
- if not null, the ACL provider to use when creating parent nodesMethod Detail |
---|
public void ensure(CuratorZookeeperClient client) throws Exception
client
- ZK client
Exception
- ZK errorspublic EnsurePath excludingLast()
public String getPath()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |