|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.talend.esb.servicelocator.client.internal.zk.ZKBackend
public class ZKBackend
| Nested Class Summary | |
|---|---|
static interface |
ZKBackend.NodeMapper<T>
|
class |
ZKBackend.WatcherImpl
|
| Field Summary | |
|---|---|
static NodePath |
LOCATOR_ROOT_PATH
|
static Charset |
UTF8_CHAR_SET
|
| Constructor Summary | |
|---|---|
ZKBackend()
|
|
| Method Summary | ||
|---|---|---|
RootNode |
connect()
Establish a connection to the Service Locator. |
|
void |
createNode(NodePath path,
org.apache.zookeeper.CreateMode mode,
byte[] content)
|
|
protected org.apache.zookeeper.ZooKeeper |
createZooKeeper(CountDownLatch connectionLatch)
|
|
boolean |
deleteNode(NodePath path,
boolean canHaveChildren)
|
|
void |
disconnect()
Disconnects from a Service Locator server. |
|
void |
ensurePathDeleted(NodePath path,
boolean canHaveChildren)
|
|
void |
ensurePathExists(NodePath path,
org.apache.zookeeper.CreateMode mode)
|
|
void |
ensurePathExists(NodePath path,
org.apache.zookeeper.CreateMode mode,
byte[] content)
|
|
|
getChildren(NodePath path,
ZKBackend.NodeMapper<T> mapper)
|
|
byte[] |
getContent(NodePath path)
|
|
RootNode |
getRootNode()
|
|
boolean |
isConnected()
|
|
boolean |
nodeExists(NodePath path)
|
|
void |
setConnectionTimeout(int timeout)
Specify the time this client waits for a connection to
get established. |
|
void |
setLocatorEndpoints(String endpoints)
Specify the endpoints of all the instances belonging to the service locator ensemble this object might potentially be talking to when connecting. |
|
void |
setNodeData(NodePath path,
byte[] content)
|
|
void |
setPassword(String passWord)
|
|
void |
setPostConnectAction(ServiceLocator.PostConnectAction postConnectAction)
Specify the action to be be executed after the Service Locator has connected to the server. |
|
void |
setSessionTimeout(int timeout)
Specify the time out of the session established at the server. |
|
void |
setUserName(String userName)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final NodePath LOCATOR_ROOT_PATH
public static final Charset UTF8_CHAR_SET
| Constructor Detail |
|---|
public ZKBackend()
| Method Detail |
|---|
public RootNode connect()
throws InterruptedException,
ServiceLocatorException
ServiceLocatorBackendServiceLocator.PostConnectAction is run. If the session
to the server expires because the server could not be reached within the
specified time, a reconnect is
automatically executed as soon as the server can be reached again.
Because after a session time out all registered endpoints are removed it
is important to specify a ServiceLocator.PostConnectAction that re-registers all
endpoints.
connect in interface ServiceLocatorBackendInterruptedException - the current Thread was interrupted when waiting
for a successful connection to the ServiceLocator
ServiceLocatorException - the connect operation failed
public void disconnect()
throws InterruptedException,
ServiceLocatorException
ServiceLocatorBackendconnect again.
disconnect in interface ServiceLocatorBackendInterruptedException - the current Thread was interrupted when waiting
for the disconnect to happen
ServiceLocatorExceptionpublic boolean isConnected()
isConnected in interface ServiceLocatorBackend
public RootNode getRootNode()
throws InterruptedException,
ServiceLocatorException
InterruptedException
ServiceLocatorException
public boolean nodeExists(NodePath path)
throws ServiceLocatorException,
InterruptedException
ServiceLocatorException
InterruptedException
public void createNode(NodePath path,
org.apache.zookeeper.CreateMode mode,
byte[] content)
throws org.apache.zookeeper.KeeperException,
InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public void setNodeData(NodePath path,
byte[] content)
throws ServiceLocatorException,
InterruptedException
ServiceLocatorException
InterruptedException
public boolean deleteNode(NodePath path,
boolean canHaveChildren)
throws org.apache.zookeeper.KeeperException,
InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public <T> List<T> getChildren(NodePath path,
ZKBackend.NodeMapper<T> mapper)
throws ServiceLocatorException,
InterruptedException
ServiceLocatorException
InterruptedException
public byte[] getContent(NodePath path)
throws ServiceLocatorException,
InterruptedException
ServiceLocatorException
InterruptedException
public void ensurePathExists(NodePath path,
org.apache.zookeeper.CreateMode mode)
throws ServiceLocatorException,
InterruptedException
ServiceLocatorException
InterruptedException
public void ensurePathExists(NodePath path,
org.apache.zookeeper.CreateMode mode,
byte[] content)
throws ServiceLocatorException,
InterruptedException
ServiceLocatorException
InterruptedException
public void ensurePathDeleted(NodePath path,
boolean canHaveChildren)
throws ServiceLocatorException,
InterruptedException
path - Path to the node to be removedcanHaveChildren - If false method throws an exception in case we
have KeeperException with code
NotEmpty. If
true, node just not be deleted in case we have
Keeper NotEmptyException.
ServiceLocatorException
InterruptedExceptionpublic void setPostConnectAction(ServiceLocator.PostConnectAction postConnectAction)
ServiceLocatorBackend
setPostConnectAction in interface ServiceLocatorBackendpostConnectAction - the action to be executed, must not be null.public void setLocatorEndpoints(String endpoints)
connecting. The object will one by one pick an
endpoint (the order is non-deterministic) to connect to the service
locator until a connection is established.
endpoints - comma separated list of endpoints,each corresponding to a
service locator instance. Each endpoint is specified as a
host:port pair. At least one endpoint must be specified. Valid
exmaples are: "127.0.0.1:2181" or
"sl1.example.com:3210, sl2.example.com:3210, sl3.example.com:3210"public void setSessionTimeout(int timeout)
sessionTimeout - timeout in milliseconds, must be greater than zero and less
than 60000.public void setConnectionTimeout(int timeout)
for a connection to
get established.
connectionTimeout - timeout in milliseconds, must be greater than zeropublic void setUserName(String userName)
public void setPassword(String passWord)
protected org.apache.zookeeper.ZooKeeper createZooKeeper(CountDownLatch connectionLatch)
throws ServiceLocatorException
ServiceLocatorException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||