Package org.apache.pulsar.metadata.impl
Class PulsarZooKeeperClient
java.lang.Object
org.apache.zookeeper.ZooKeeper
org.apache.pulsar.metadata.impl.PulsarZooKeeperClient
- All Implemented Interfaces:
AutoCloseable,Watcher
Provide a zookeeper client to handle session expire.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA builder to build retryable zookeeper client.Nested classes/interfaces inherited from class org.apache.zookeeper.ZooKeeper
ZooKeeper.States, ZooKeeper.WatchRegistrationNested classes/interfaces inherited from interface org.apache.zookeeper.Watcher
Watcher.Event, Watcher.WatcherType -
Field Summary
Fields inherited from class org.apache.zookeeper.ZooKeeper
cnxn, hostProvider, SECURE_CLIENT, ZOOKEEPER_CLIENT_CNXN_SOCKET -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPulsarZooKeeperClient(String connectString, int sessionTimeoutMs, org.apache.bookkeeper.zookeeper.ZooKeeperWatcherBase watcherManager, org.apache.bookkeeper.zookeeper.RetryPolicy connectRetryPolicy, org.apache.bookkeeper.zookeeper.RetryPolicy operationRetryPolicy, org.apache.bookkeeper.stats.StatsLogger statsLogger, int retryExecThreadCount, double rate, boolean allowReadOnlyMode) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAuthInfo(String scheme, byte[] auth) voidaddWatch(String basePath, Watcher watcher, AddWatchMode mode) voidaddWatch(String basePath, Watcher watcher, AddWatchMode mode, AsyncCallback.VoidCallback cb, Object ctx) voidclose()create(String path, byte[] data, List<org.apache.zookeeper.data.ACL> acl, CreateMode createMode) voidcreate(String path, byte[] data, List<org.apache.zookeeper.data.ACL> acl, CreateMode createMode, AsyncCallback.StringCallback cb, Object context) protected ZooKeepervoidvoiddelete(String path, int version, AsyncCallback.VoidCallback cb, Object context) org.apache.zookeeper.data.Statvoidexists(String path, boolean watch, AsyncCallback.StatCallback cb, Object context) org.apache.zookeeper.data.Statvoidexists(String path, Watcher watcher, AsyncCallback.StatCallback cb, Object context) List<org.apache.zookeeper.data.ACL>voidgetACL(String path, org.apache.zookeeper.data.Stat stat, AsyncCallback.ACLCallback cb, Object context) getChildren(String path, boolean watch) voidgetChildren(String path, boolean watch, AsyncCallback.Children2Callback cb, Object context) voidgetChildren(String path, boolean watch, AsyncCallback.ChildrenCallback cb, Object context) getChildren(String path, boolean watch, org.apache.zookeeper.data.Stat stat) getChildren(String path, Watcher watcher) voidgetChildren(String path, Watcher watcher, AsyncCallback.Children2Callback cb, Object context) voidgetChildren(String path, Watcher watcher, AsyncCallback.ChildrenCallback cb, Object context) getChildren(String path, Watcher watcher, org.apache.zookeeper.data.Stat stat) voidgetData(String path, boolean watch, AsyncCallback.DataCallback cb, Object context) byte[]voidgetData(String path, Watcher watcher, AsyncCallback.DataCallback cb, Object context) byte[]longbyte[]intgetState()voidmulti(Iterable<Op> ops, AsyncCallback.MultiCallback cb, Object context) voidprocess(WatchedEvent event) voidorg.apache.zookeeper.data.StatvoidsetACL(String path, List<org.apache.zookeeper.data.ACL> acl, int version, AsyncCallback.StatCallback cb, Object context) org.apache.zookeeper.data.StatvoidsetData(String path, byte[] data, int version, AsyncCallback.StatCallback cb, Object context) voidsync(String path, AsyncCallback.VoidCallback cb, Object context) toString()Deprecated.voidMethods inherited from class org.apache.zookeeper.ZooKeeper
addWatch, addWatch, close, create, create, create, create, getAllChildrenNumber, getAllChildrenNumber, getChildWatches, getClientConfig, getConfig, getConfig, getConfig, getConfig, getDataWatches, getEphemerals, getEphemerals, getEphemerals, getEphemerals, getExistWatches, getPersistentRecursiveWatches, getPersistentWatches, getSaslClient, getTestable, multiInternal, multiInternal, removeAllWatches, removeAllWatches, removeWatches, removeWatches, testableLocalSocketAddress, testableRemoteSocketAddress, testableWaitForShutdown, updateServerList, whoAmI
-
Constructor Details
-
PulsarZooKeeperClient
protected PulsarZooKeeperClient(String connectString, int sessionTimeoutMs, org.apache.bookkeeper.zookeeper.ZooKeeperWatcherBase watcherManager, org.apache.bookkeeper.zookeeper.RetryPolicy connectRetryPolicy, org.apache.bookkeeper.zookeeper.RetryPolicy operationRetryPolicy, org.apache.bookkeeper.stats.StatsLogger statsLogger, int retryExecThreadCount, double rate, boolean allowReadOnlyMode) throws IOException - Throws:
IOException
-
-
Method Details
-
newBuilder
-
close
- Specified by:
closein interfaceAutoCloseable- Overrides:
closein classZooKeeper- Throws:
InterruptedException
-
waitForConnection
- Throws:
KeeperExceptionInterruptedException
-
createZooKeeper
- Throws:
IOException
-
process
-
getSessionId
public long getSessionId()- Overrides:
getSessionIdin classZooKeeper
-
getSessionPasswd
public byte[] getSessionPasswd()- Overrides:
getSessionPasswdin classZooKeeper
-
getSessionTimeout
public int getSessionTimeout()- Overrides:
getSessionTimeoutin classZooKeeper
-
addAuthInfo
- Overrides:
addAuthInfoin classZooKeeper
-
register
-
multi
- Overrides:
multiin classZooKeeper- Throws:
InterruptedExceptionKeeperException
-
multi
-
transaction
Deprecated.- Overrides:
transactionin classZooKeeper
-
getACL
public List<org.apache.zookeeper.data.ACL> getACL(String path, org.apache.zookeeper.data.Stat stat) throws KeeperException, InterruptedException - Overrides:
getACLin classZooKeeper- Throws:
KeeperExceptionInterruptedException
-
getACL
public void getACL(String path, org.apache.zookeeper.data.Stat stat, AsyncCallback.ACLCallback cb, Object context) -
setACL
public org.apache.zookeeper.data.Stat setACL(String path, List<org.apache.zookeeper.data.ACL> acl, int version) throws KeeperException, InterruptedException - Overrides:
setACLin classZooKeeper- Throws:
KeeperExceptionInterruptedException
-
setACL
public void setACL(String path, List<org.apache.zookeeper.data.ACL> acl, int version, AsyncCallback.StatCallback cb, Object context) -
sync
-
getState
-
toString
-
create
public String create(String path, byte[] data, List<org.apache.zookeeper.data.ACL> acl, CreateMode createMode) throws KeeperException, InterruptedException - Overrides:
createin classZooKeeper- Throws:
KeeperExceptionInterruptedException
-
create
public void create(String path, byte[] data, List<org.apache.zookeeper.data.ACL> acl, CreateMode createMode, AsyncCallback.StringCallback cb, Object context) -
delete
- Overrides:
deletein classZooKeeper- Throws:
KeeperExceptionInterruptedException
-
delete
-
exists
public org.apache.zookeeper.data.Stat exists(String path, Watcher watcher) throws KeeperException, InterruptedException - Overrides:
existsin classZooKeeper- Throws:
KeeperExceptionInterruptedException
-
exists
public org.apache.zookeeper.data.Stat exists(String path, boolean watch) throws KeeperException, InterruptedException - Overrides:
existsin classZooKeeper- Throws:
KeeperExceptionInterruptedException
-
exists
-
exists
-
getData
public byte[] getData(String path, Watcher watcher, org.apache.zookeeper.data.Stat stat) throws KeeperException, InterruptedException - Overrides:
getDatain classZooKeeper- Throws:
KeeperExceptionInterruptedException
-
getData
public byte[] getData(String path, boolean watch, org.apache.zookeeper.data.Stat stat) throws KeeperException, InterruptedException - Overrides:
getDatain classZooKeeper- Throws:
KeeperExceptionInterruptedException
-
getData
-
getData
-
setData
public org.apache.zookeeper.data.Stat setData(String path, byte[] data, int version) throws KeeperException, InterruptedException - Overrides:
setDatain classZooKeeper- Throws:
KeeperExceptionInterruptedException
-
setData
public void setData(String path, byte[] data, int version, AsyncCallback.StatCallback cb, Object context) -
addWatch
public void addWatch(String basePath, Watcher watcher, AddWatchMode mode) throws KeeperException, InterruptedException - Overrides:
addWatchin classZooKeeper- Throws:
KeeperExceptionInterruptedException
-
addWatch
public void addWatch(String basePath, Watcher watcher, AddWatchMode mode, AsyncCallback.VoidCallback cb, Object ctx) -
getChildren
public List<String> getChildren(String path, Watcher watcher, org.apache.zookeeper.data.Stat stat) throws KeeperException, InterruptedException - Overrides:
getChildrenin classZooKeeper- Throws:
KeeperExceptionInterruptedException
-
getChildren
public List<String> getChildren(String path, boolean watch, org.apache.zookeeper.data.Stat stat) throws KeeperException, InterruptedException - Overrides:
getChildrenin classZooKeeper- Throws:
KeeperExceptionInterruptedException
-
getChildren
public void getChildren(String path, Watcher watcher, AsyncCallback.Children2Callback cb, Object context) - Overrides:
getChildrenin classZooKeeper
-
getChildren
public void getChildren(String path, boolean watch, AsyncCallback.Children2Callback cb, Object context) - Overrides:
getChildrenin classZooKeeper
-
getChildren
public List<String> getChildren(String path, Watcher watcher) throws KeeperException, InterruptedException - Overrides:
getChildrenin classZooKeeper- Throws:
KeeperExceptionInterruptedException
-
getChildren
public List<String> getChildren(String path, boolean watch) throws KeeperException, InterruptedException - Overrides:
getChildrenin classZooKeeper- Throws:
KeeperExceptionInterruptedException
-
getChildren
public void getChildren(String path, Watcher watcher, AsyncCallback.ChildrenCallback cb, Object context) - Overrides:
getChildrenin classZooKeeper
-
getChildren
public void getChildren(String path, boolean watch, AsyncCallback.ChildrenCallback cb, Object context) - Overrides:
getChildrenin classZooKeeper
-