public class LocalClusterSessionFactory.LocalSession extends Object implements ClusterInfoSession, DisruptibleSession
Constructor and Description |
---|
LocalSession() |
Modifier and Type | Method and Description |
---|---|
void |
disrupt() |
boolean |
exists(String path,
ClusterInfoWatcher watcher)
Check if a path has already been created.
|
Object |
getData(String path,
ClusterInfoWatcher watcher)
If data is stored at the node indicated by the path, then the data will be returned.
|
Collection<String> |
getSubdirs(String path,
ClusterInfoWatcher watcher)
Show all of the subdirectories of the given directory.
|
String |
mkdir(String path,
Object data,
DirMode mode)
This will create a node at the given path.
|
void |
rmdir(String path)
This will remove the directory stored at the path.
|
void |
setData(String path,
Object data)
Set the data associated with the tree node identified by the path.
|
void |
stop()
Stop the session.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, recursiveMkdir
public String mkdir(String path, Object data, DirMode mode) throws ClusterInfoException
ClusterInfoSession
mkdir
in interface ClusterInfoSession
path
- a '/' separated path to a directory in the cluster information manager to create.data
- optional data to set for that directorymode
- is the mode to set for the new directory. See DirMode
.null
if the directory cannot be created
or already exists. If the DirMode
is sequential then the result will satisfy the SEQUENTIAL
requirements (see DirMode
for the details).ClusterInfoException
- on an error which can include the fact that the parent directory doesn't exist (when it
should throw a ClusterInfoException.NoParentException
) or if you add a directory as a subdir of an
EPHEMERAL directory.public void rmdir(String path) throws ClusterInfoException
ClusterInfoSession
rmdir
in interface ClusterInfoSession
path
- is the directory to delete.ClusterInfoException
- if there is no node at the given path.public boolean exists(String path, ClusterInfoWatcher watcher) throws ClusterInfoException
ClusterInfoSession
exists
in interface ClusterInfoSession
path
- is the directory to checkwatcher
- if non-null, and the path exists, then the watcher will be called back whenever the node at the path has data added to it, or is deleted.ClusterInfoException
- if there is an unforeseen problem.public Object getData(String path, ClusterInfoWatcher watcher) throws ClusterInfoException
ClusterInfoSession
getData
in interface ClusterInfoSession
path
- place to put the data.watcher
- if non-null, and the path exists, then the watcher will be called back whenever the node at the path has data added to it, or is deleted.ClusterInfoException
public void setData(String path, Object data) throws ClusterInfoException
ClusterInfoSession
setData
in interface ClusterInfoSession
path
- identify the directory/tree node of the place to store the datadata
- the data to put at the given location.ClusterInfoException
public Collection<String> getSubdirs(String path, ClusterInfoWatcher watcher) throws ClusterInfoException
ClusterInfoSession
getSubdirs
in interface ClusterInfoSession
path
- where the subdirectories to show are.watcher
- if non-null, and the path exists, then the watcher will be called back whenever the node at the path has data added to it, or is deleted.ClusterInfoException
public void stop()
ClusterInfoSession
stop
in interface ClusterInfoSession
public void disrupt()
disrupt
in interface DisruptibleSession
Copyright © 2018. All rights reserved.