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,org.apache.zookeeper.Watcher
public class PulsarZooKeeperClient
extends org.apache.zookeeper.ZooKeeper
implements org.apache.zookeeper.Watcher, AutoCloseable
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
org.apache.zookeeper.ZooKeeper.States, org.apache.zookeeper.ZooKeeper.WatchRegistrationNested classes/interfaces inherited from interface org.apache.zookeeper.Watcher
org.apache.zookeeper.Watcher.Event, org.apache.zookeeper.Watcher.WatcherType -
Field Summary
Fields inherited from class org.apache.zookeeper.ZooKeeper
cnxn, hostProvider, SECURE_CLIENT, watchManager, 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, org.apache.zookeeper.Watcher watcher, org.apache.zookeeper.AddWatchMode mode) voidaddWatch(String basePath, org.apache.zookeeper.Watcher watcher, org.apache.zookeeper.AddWatchMode mode, org.apache.zookeeper.AsyncCallback.VoidCallback cb, Object ctx) voidclose()create(String path, byte[] data, List<org.apache.zookeeper.data.ACL> acl, org.apache.zookeeper.CreateMode createMode) voidcreate(String path, byte[] data, List<org.apache.zookeeper.data.ACL> acl, org.apache.zookeeper.CreateMode createMode, org.apache.zookeeper.AsyncCallback.StringCallback cb, Object context) protected org.apache.zookeeper.ZooKeepervoidvoiddelete(String path, int version, org.apache.zookeeper.AsyncCallback.VoidCallback cb, Object context) org.apache.zookeeper.data.Statvoidexists(String path, boolean watch, org.apache.zookeeper.AsyncCallback.StatCallback cb, Object context) org.apache.zookeeper.data.Statvoidexists(String path, org.apache.zookeeper.Watcher watcher, org.apache.zookeeper.AsyncCallback.StatCallback cb, Object context) List<org.apache.zookeeper.data.ACL>voidgetACL(String path, org.apache.zookeeper.data.Stat stat, org.apache.zookeeper.AsyncCallback.ACLCallback cb, Object context) getChildren(String path, boolean watch) voidgetChildren(String path, boolean watch, org.apache.zookeeper.AsyncCallback.Children2Callback cb, Object context) voidgetChildren(String path, boolean watch, org.apache.zookeeper.AsyncCallback.ChildrenCallback cb, Object context) getChildren(String path, boolean watch, org.apache.zookeeper.data.Stat stat) getChildren(String path, org.apache.zookeeper.Watcher watcher) voidgetChildren(String path, org.apache.zookeeper.Watcher watcher, org.apache.zookeeper.AsyncCallback.Children2Callback cb, Object context) voidgetChildren(String path, org.apache.zookeeper.Watcher watcher, org.apache.zookeeper.AsyncCallback.ChildrenCallback cb, Object context) getChildren(String path, org.apache.zookeeper.Watcher watcher, org.apache.zookeeper.data.Stat stat) voidgetData(String path, boolean watch, org.apache.zookeeper.AsyncCallback.DataCallback cb, Object context) byte[]voidgetData(String path, org.apache.zookeeper.Watcher watcher, org.apache.zookeeper.AsyncCallback.DataCallback cb, Object context) byte[]longbyte[]intorg.apache.zookeeper.ZooKeeper.StatesgetState()List<org.apache.zookeeper.OpResult>voidmulti(Iterable<org.apache.zookeeper.Op> ops, org.apache.zookeeper.AsyncCallback.MultiCallback cb, Object context) voidprocess(org.apache.zookeeper.WatchedEvent event) voidregister(org.apache.zookeeper.Watcher watcher) org.apache.zookeeper.data.StatvoidsetACL(String path, List<org.apache.zookeeper.data.ACL> acl, int version, org.apache.zookeeper.AsyncCallback.StatCallback cb, Object context) org.apache.zookeeper.data.StatvoidsetData(String path, byte[] data, int version, org.apache.zookeeper.AsyncCallback.StatCallback cb, Object context) voidtoString()org.apache.zookeeper.TransactionDeprecated.voidMethods inherited from class org.apache.zookeeper.ZooKeeper
addWatch, addWatch, close, create, create, create, create, createConnection, defaultWatchManager, 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
-
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 classorg.apache.zookeeper.ZooKeeper- Throws:
InterruptedException
-
waitForConnection
- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
createZooKeeper
- Throws:
IOException
-
process
public void process(org.apache.zookeeper.WatchedEvent event) - Specified by:
processin interfaceorg.apache.zookeeper.Watcher
-
getSessionId
public long getSessionId()- Overrides:
getSessionIdin classorg.apache.zookeeper.ZooKeeper
-
getSessionPasswd
public byte[] getSessionPasswd()- Overrides:
getSessionPasswdin classorg.apache.zookeeper.ZooKeeper
-
getSessionTimeout
public int getSessionTimeout()- Overrides:
getSessionTimeoutin classorg.apache.zookeeper.ZooKeeper
-
addAuthInfo
- Overrides:
addAuthInfoin classorg.apache.zookeeper.ZooKeeper
-
register
public void register(org.apache.zookeeper.Watcher watcher) - Overrides:
registerin classorg.apache.zookeeper.ZooKeeper
-
multi
public List<org.apache.zookeeper.OpResult> multi(Iterable<org.apache.zookeeper.Op> ops) throws InterruptedException, org.apache.zookeeper.KeeperException - Overrides:
multiin classorg.apache.zookeeper.ZooKeeper- Throws:
InterruptedExceptionorg.apache.zookeeper.KeeperException
-
multi
public void multi(Iterable<org.apache.zookeeper.Op> ops, org.apache.zookeeper.AsyncCallback.MultiCallback cb, Object context) - Overrides:
multiin classorg.apache.zookeeper.ZooKeeper
-
transaction
Deprecated.- Overrides:
transactionin classorg.apache.zookeeper.ZooKeeper
-
getACL
public List<org.apache.zookeeper.data.ACL> getACL(String path, org.apache.zookeeper.data.Stat stat) throws org.apache.zookeeper.KeeperException, InterruptedException - Overrides:
getACLin classorg.apache.zookeeper.ZooKeeper- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
getACL
public void getACL(String path, org.apache.zookeeper.data.Stat stat, org.apache.zookeeper.AsyncCallback.ACLCallback cb, Object context) - Overrides:
getACLin classorg.apache.zookeeper.ZooKeeper
-
setACL
public org.apache.zookeeper.data.Stat setACL(String path, List<org.apache.zookeeper.data.ACL> acl, int version) throws org.apache.zookeeper.KeeperException, InterruptedException - Overrides:
setACLin classorg.apache.zookeeper.ZooKeeper- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
setACL
public void setACL(String path, List<org.apache.zookeeper.data.ACL> acl, int version, org.apache.zookeeper.AsyncCallback.StatCallback cb, Object context) - Overrides:
setACLin classorg.apache.zookeeper.ZooKeeper
-
sync
- Overrides:
syncin classorg.apache.zookeeper.ZooKeeper
-
getState
public org.apache.zookeeper.ZooKeeper.States getState()- Overrides:
getStatein classorg.apache.zookeeper.ZooKeeper
-
toString
- Overrides:
toStringin classorg.apache.zookeeper.ZooKeeper
-
create
public String create(String path, byte[] data, List<org.apache.zookeeper.data.ACL> acl, org.apache.zookeeper.CreateMode createMode) throws org.apache.zookeeper.KeeperException, InterruptedException - Overrides:
createin classorg.apache.zookeeper.ZooKeeper- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
create
public void create(String path, byte[] data, List<org.apache.zookeeper.data.ACL> acl, org.apache.zookeeper.CreateMode createMode, org.apache.zookeeper.AsyncCallback.StringCallback cb, Object context) - Overrides:
createin classorg.apache.zookeeper.ZooKeeper
-
delete
public void delete(String path, int version) throws org.apache.zookeeper.KeeperException, InterruptedException - Overrides:
deletein classorg.apache.zookeeper.ZooKeeper- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
delete
public void delete(String path, int version, org.apache.zookeeper.AsyncCallback.VoidCallback cb, Object context) - Overrides:
deletein classorg.apache.zookeeper.ZooKeeper
-
exists
public org.apache.zookeeper.data.Stat exists(String path, org.apache.zookeeper.Watcher watcher) throws org.apache.zookeeper.KeeperException, InterruptedException - Overrides:
existsin classorg.apache.zookeeper.ZooKeeper- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
exists
public org.apache.zookeeper.data.Stat exists(String path, boolean watch) throws org.apache.zookeeper.KeeperException, InterruptedException - Overrides:
existsin classorg.apache.zookeeper.ZooKeeper- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
exists
public void exists(String path, org.apache.zookeeper.Watcher watcher, org.apache.zookeeper.AsyncCallback.StatCallback cb, Object context) - Overrides:
existsin classorg.apache.zookeeper.ZooKeeper
-
exists
public void exists(String path, boolean watch, org.apache.zookeeper.AsyncCallback.StatCallback cb, Object context) - Overrides:
existsin classorg.apache.zookeeper.ZooKeeper
-
getData
public byte[] getData(String path, org.apache.zookeeper.Watcher watcher, org.apache.zookeeper.data.Stat stat) throws org.apache.zookeeper.KeeperException, InterruptedException - Overrides:
getDatain classorg.apache.zookeeper.ZooKeeper- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
getData
public byte[] getData(String path, boolean watch, org.apache.zookeeper.data.Stat stat) throws org.apache.zookeeper.KeeperException, InterruptedException - Overrides:
getDatain classorg.apache.zookeeper.ZooKeeper- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
getData
public void getData(String path, org.apache.zookeeper.Watcher watcher, org.apache.zookeeper.AsyncCallback.DataCallback cb, Object context) - Overrides:
getDatain classorg.apache.zookeeper.ZooKeeper
-
getData
public void getData(String path, boolean watch, org.apache.zookeeper.AsyncCallback.DataCallback cb, Object context) - Overrides:
getDatain classorg.apache.zookeeper.ZooKeeper
-
setData
public org.apache.zookeeper.data.Stat setData(String path, byte[] data, int version) throws org.apache.zookeeper.KeeperException, InterruptedException - Overrides:
setDatain classorg.apache.zookeeper.ZooKeeper- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
setData
public void setData(String path, byte[] data, int version, org.apache.zookeeper.AsyncCallback.StatCallback cb, Object context) - Overrides:
setDatain classorg.apache.zookeeper.ZooKeeper
-
addWatch
public void addWatch(String basePath, org.apache.zookeeper.Watcher watcher, org.apache.zookeeper.AddWatchMode mode) throws org.apache.zookeeper.KeeperException, InterruptedException - Overrides:
addWatchin classorg.apache.zookeeper.ZooKeeper- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
addWatch
public void addWatch(String basePath, org.apache.zookeeper.Watcher watcher, org.apache.zookeeper.AddWatchMode mode, org.apache.zookeeper.AsyncCallback.VoidCallback cb, Object ctx) - Overrides:
addWatchin classorg.apache.zookeeper.ZooKeeper
-
getChildren
public List<String> getChildren(String path, org.apache.zookeeper.Watcher watcher, org.apache.zookeeper.data.Stat stat) throws org.apache.zookeeper.KeeperException, InterruptedException - Overrides:
getChildrenin classorg.apache.zookeeper.ZooKeeper- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
getChildren
public List<String> getChildren(String path, boolean watch, org.apache.zookeeper.data.Stat stat) throws org.apache.zookeeper.KeeperException, InterruptedException - Overrides:
getChildrenin classorg.apache.zookeeper.ZooKeeper- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
getChildren
public void getChildren(String path, org.apache.zookeeper.Watcher watcher, org.apache.zookeeper.AsyncCallback.Children2Callback cb, Object context) - Overrides:
getChildrenin classorg.apache.zookeeper.ZooKeeper
-
getChildren
public void getChildren(String path, boolean watch, org.apache.zookeeper.AsyncCallback.Children2Callback cb, Object context) - Overrides:
getChildrenin classorg.apache.zookeeper.ZooKeeper
-
getChildren
public List<String> getChildren(String path, org.apache.zookeeper.Watcher watcher) throws org.apache.zookeeper.KeeperException, InterruptedException - Overrides:
getChildrenin classorg.apache.zookeeper.ZooKeeper- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
getChildren
public List<String> getChildren(String path, boolean watch) throws org.apache.zookeeper.KeeperException, InterruptedException - Overrides:
getChildrenin classorg.apache.zookeeper.ZooKeeper- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
getChildren
public void getChildren(String path, org.apache.zookeeper.Watcher watcher, org.apache.zookeeper.AsyncCallback.ChildrenCallback cb, Object context) - Overrides:
getChildrenin classorg.apache.zookeeper.ZooKeeper
-
getChildren
public void getChildren(String path, boolean watch, org.apache.zookeeper.AsyncCallback.ChildrenCallback cb, Object context) - Overrides:
getChildrenin classorg.apache.zookeeper.ZooKeeper
-