Database Reference
In-Depth Information
Path Created: CuratorEventImpl{
type=CREATE,
resultCode=0,
path='/a/test/path',
name='/a/test/path',
children=null,
context=null,
stat=null,
data=null,
watchedEvent=null,
aclList=null
}
To create paths with different modes, use the withMode method in the
create command. For example, a queuing system might want to create
znode s that are both persistent and sequential:
client.create()
.withMode(CreateMode. PERSISTENT_SEQUENTIAL )
.forPath("/queue/job")
;
Valid modes are PERSISTENT , EPHEMERAL , PERSISTENT_SEQUENTIAL ,
and EPHEMERAL_SEQUENTIAL . The mode can also be determined using
the CreateMode .fromFlag method, which converts the flags used by
the native ZooKeeper client to the appropriate CreateMode option as
demonstrated in the wiley.streaming .curator.ModeTest example.
The checkExists command has two uses. First, whether or not the
command returns null allows for the existence check implied by its name.
If the path given exists, a Stat object is returned with a variety of useful
information about the path. This includes the number of children the path
has, the version number, and the creation and modification times.
The data element or children of a znode are retrieved using the getData
and getChildren commands, respectively. Like the create command,
they can be executed in the background and always end with a forPath
method. Unlike create , they do not take an optional byte array in their
path.
Search WWH ::




Custom Search