|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.linkedin.zookeeper.client.AbstractZooKeeper
org.linkedin.zookeeper.client.AbstractZKClient
org.linkedin.zookeeper.client.ZKClient
public class ZKClient
| Nested Class Summary | |
|---|---|
static class |
ZKClient.State
|
| Nested classes/interfaces inherited from interface org.apache.zookeeper.Watcher |
|---|
org.apache.zookeeper.Watcher.Event |
| Field Summary | |
|---|---|
static org.slf4j.Logger |
log
|
static java.lang.String |
MODULE
|
| Constructor Summary | |
|---|---|
ZKClient(IZooKeeperFactory factory)
Constructor |
|
ZKClient(IZooKeeperFactory factory,
java.lang.String chroot)
Constructor |
|
ZKClient(java.lang.String connectString,
org.linkedin.util.clock.Timespan sessionTimeout,
org.apache.zookeeper.Watcher watcher)
Constructor |
|
| Method Summary | |
|---|---|
IZKClient |
chroot(java.lang.String path)
|
void |
destroy()
|
org.linkedin.util.clock.Clock |
getClock()
|
IZooKeeperFactory |
getFactory()
|
java.util.Set<LifecycleListener> |
getListeners()
|
org.linkedin.util.clock.Timespan |
getReconnectTimeout()
|
protected IZooKeeper |
getZk()
|
ZKClient.State |
getZKClientState()
|
boolean |
isConnected()
|
void |
process(org.apache.zookeeper.WatchedEvent event)
|
void |
registerListener(LifecycleListener listener)
When the listener is set, it will receive the LifecycleListener.onConnected() callback
right away if ZooKeeper is already connected. |
void |
removeListener(LifecycleListener listener)
Removes a listener previously set with registerListener(LifecycleListener) |
void |
setClock(org.linkedin.util.clock.Clock clock)
|
void |
setReconnectTimeout(org.linkedin.util.clock.Timespan reconnectTimeout)
|
void |
start()
|
void |
waitForStart()
Wait (no longer than timeout if provided) for the client to be started |
void |
waitForStart(org.linkedin.util.clock.Timespan timeout)
Wait (no longer than timeout if provided) for the client to be started |
void |
waitForState(ZKClient.State state,
org.linkedin.util.clock.Timespan timeout)
Wait (no longer than timeout if provided) for the client to be started |
| Methods inherited from class org.linkedin.zookeeper.client.AbstractZKClient |
|---|
create, createBytesNode, createBytesNodeWithParents, createOrSetWithParents, createWithParents, delete, deleteWithChildren, exists, getAllChildren, getChildren, getData, getStringData, getZKByteData, getZKByteData, getZKChildren, getZKStringData, getZKStringData, setByteData, setData |
| Methods inherited from class org.linkedin.zookeeper.client.AbstractZooKeeper |
|---|
addAuthInfo, adjustPath, adjustPath, close, create, create, delete, delete, exists, exists, exists, exists, getACL, getACL, getChildren, getChildren, getChildren, getChildren, getChildren, getChildren, getChildren, getChildren, getData, getData, getData, getData, getSessionId, getSessionPasswd, getSessionTimeout, getState, register, setACL, setACL, setData, setData, sync |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.linkedin.zookeeper.client.IZooKeeper |
|---|
addAuthInfo, close, create, create, delete, delete, exists, exists, exists, exists, getACL, getACL, getChildren, getChildren, getChildren, getChildren, getChildren, getChildren, getChildren, getChildren, getData, getData, getData, getData, getSessionId, getSessionPasswd, getSessionTimeout, getState, register, setACL, setACL, setData, setData, sync |
| Field Detail |
|---|
public static final java.lang.String MODULE
public static final org.slf4j.Logger log
| Constructor Detail |
|---|
public ZKClient(java.lang.String connectString,
org.linkedin.util.clock.Timespan sessionTimeout,
org.apache.zookeeper.Watcher watcher)
public ZKClient(IZooKeeperFactory factory)
public ZKClient(IZooKeeperFactory factory,
java.lang.String chroot)
| Method Detail |
|---|
public ZKClient.State getZKClientState()
public IZooKeeperFactory getFactory()
public org.linkedin.util.clock.Clock getClock()
public void setClock(org.linkedin.util.clock.Clock clock)
public org.linkedin.util.clock.Timespan getReconnectTimeout()
public void setReconnectTimeout(org.linkedin.util.clock.Timespan reconnectTimeout)
public java.util.Set<LifecycleListener> getListeners()
public void registerListener(LifecycleListener listener)
LifecycleListener.onConnected() callback
right away if ZooKeeper is already connected. This guarantees that you will never miss the
connected event irrelevant of whether you set the listener before or after calling
start().
registerListener in interface IZKClientlistener - the listenerpublic void removeListener(LifecycleListener listener)
registerListener(LifecycleListener)
removeListener in interface IZKClientlistener - public IZKClient chroot(java.lang.String path)
chroot in interface IZKClientpublic void start()
start in interface org.linkedin.util.lifecycle.Startablepublic boolean isConnected()
isConnected in interface IZKClienttrue if connected
public void waitForStart()
throws java.lang.InterruptedException
java.lang.InterruptedException
public void waitForStart(org.linkedin.util.clock.Timespan timeout)
throws java.util.concurrent.TimeoutException,
java.lang.InterruptedException
java.util.concurrent.TimeoutException
java.lang.InterruptedException
public void waitForState(ZKClient.State state,
org.linkedin.util.clock.Timespan timeout)
throws java.util.concurrent.TimeoutException,
java.lang.InterruptedException
java.util.concurrent.TimeoutException
java.lang.InterruptedExceptionpublic void destroy()
destroy in interface org.linkedin.util.lifecycle.Destroyablepublic void process(org.apache.zookeeper.WatchedEvent event)
process in interface org.apache.zookeeper.Watcher
protected IZooKeeper getZk()
throws org.linkedin.util.exceptions.InternalException
getZk in class AbstractZooKeeperorg.linkedin.util.exceptions.InternalException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||