@InterfaceAudience.Public public class ZooKeeperAdmin extends ZooKeeper
ZooKeeper
class document for more details.ZooKeeper.States
SECURE_CLIENT, ZOOKEEPER_CLIENT_CNXN_SOCKET
Constructor and Description |
---|
ZooKeeperAdmin(java.lang.String connectString,
int sessionTimeout,
Watcher watcher)
Create a ZooKeeperAdmin object which is used to perform dynamic reconfiguration
operations.
|
ZooKeeperAdmin(java.lang.String connectString,
int sessionTimeout,
Watcher watcher,
boolean canBeReadOnly)
Create a ZooKeeperAdmin object which is used to perform dynamic reconfiguration
operations.
|
ZooKeeperAdmin(java.lang.String connectString,
int sessionTimeout,
Watcher watcher,
ZKClientConfig conf)
Create a ZooKeeperAdmin object which is used to perform dynamic reconfiguration
operations.
|
Modifier and Type | Method and Description |
---|---|
void |
reconfigure(java.util.List<java.lang.String> joiningServers,
java.util.List<java.lang.String> leavingServers,
java.util.List<java.lang.String> newMembers,
long fromConfig,
AsyncCallback.DataCallback cb,
java.lang.Object ctx)
Convenience wrapper around asynchronous reconfig that takes Lists of strings instead of comma-separated servers.
|
byte[] |
reconfigure(java.util.List<java.lang.String> joiningServers,
java.util.List<java.lang.String> leavingServers,
java.util.List<java.lang.String> newMembers,
long fromConfig,
Stat stat)
Convenience wrapper around reconfig that takes Lists of strings instead of comma-separated servers.
|
void |
reconfigure(java.lang.String joiningServers,
java.lang.String leavingServers,
java.lang.String newMembers,
long fromConfig,
AsyncCallback.DataCallback cb,
java.lang.Object ctx)
The Asynchronous version of reconfig.
|
byte[] |
reconfigure(java.lang.String joiningServers,
java.lang.String leavingServers,
java.lang.String newMembers,
long fromConfig,
Stat stat)
Reconfigure - add/remove servers.
|
java.lang.String |
toString()
String representation of this ZooKeeperAdmin client.
|
addAuthInfo, close, close, create, create, create, create, create, create, delete, delete, exists, exists, exists, exists, getACL, getACL, getChildren, getChildren, getChildren, getChildren, getChildren, getChildren, getChildren, getChildren, getClientConfig, getConfig, getConfig, getConfig, getConfig, getData, getData, getData, getData, getSaslClient, getSessionId, getSessionPasswd, getSessionTimeout, getState, getTestable, multi, multi, reconfig, reconfig, reconfig, reconfig, register, removeAllWatches, removeAllWatches, removeWatches, removeWatches, setACL, setACL, setData, setData, sync, transaction, updateServerList
public ZooKeeperAdmin(java.lang.String connectString, int sessionTimeout, Watcher watcher) throws java.io.IOException
connectString
- comma separated host:port pairs, each corresponding to a zk
server. e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002" If
the optional chroot suffix is used the example would look
like: "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002/app/a"
where the client would be rooted at "/app/a" and all paths
would be relative to this root - ie getting/setting/etc...
"/foo/bar" would result in operations being run on
"/app/a/foo/bar" (from the server perspective).sessionTimeout
- session timeout in millisecondswatcher
- a watcher object which will be notified of state changes, may
also be notified for node eventsjava.io.IOException
- in cases of network failurejava.lang.IllegalArgumentException
- if an invalid chroot path is specifiedZooKeeper.ZooKeeper(String, int, Watcher)
public ZooKeeperAdmin(java.lang.String connectString, int sessionTimeout, Watcher watcher, ZKClientConfig conf) throws java.io.IOException
connectString
- comma separated host:port pairs, each corresponding to a zk
server. e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002" If
the optional chroot suffix is used the example would look
like: "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002/app/a"
where the client would be rooted at "/app/a" and all paths
would be relative to this root - ie getting/setting/etc...
"/foo/bar" would result in operations being run on
"/app/a/foo/bar" (from the server perspective).sessionTimeout
- session timeout in millisecondswatcher
- a watcher object which will be notified of state changes, may
also be notified for node eventsconf
- passing this conf object gives each client the flexibility of
configuring properties differently compared to other instancesjava.io.IOException
- in cases of network failurejava.lang.IllegalArgumentException
- if an invalid chroot path is specifiedZooKeeper.ZooKeeper(String, int, Watcher, ZKClientConfig)
public ZooKeeperAdmin(java.lang.String connectString, int sessionTimeout, Watcher watcher, boolean canBeReadOnly) throws java.io.IOException
connectString
- comma separated host:port pairs, each corresponding to a zk
server. e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002" If
the optional chroot suffix is used the example would look
like: "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002/app/a"
where the client would be rooted at "/app/a" and all paths
would be relative to this root - ie getting/setting/etc...
"/foo/bar" would result in operations being run on
"/app/a/foo/bar" (from the server perspective).sessionTimeout
- session timeout in millisecondswatcher
- a watcher object which will be notified of state changes, may
also be notified for node eventscanBeReadOnly
- whether the created client is allowed to go to
read-only mode in case of partitioning. Read-only mode
basically means that if the client can't find any majority
servers but there's partitioned server it could reach, it
connects to one in read-only mode, i.e. read requests are
allowed while write requests are not. It continues seeking for
majority in the background.java.io.IOException
- in cases of network failurejava.lang.IllegalArgumentException
- if an invalid chroot path is specifiedZooKeeper.ZooKeeper(String, int, Watcher, boolean)
public byte[] reconfigure(java.lang.String joiningServers, java.lang.String leavingServers, java.lang.String newMembers, long fromConfig, Stat stat) throws KeeperException, java.lang.InterruptedException
joiningServers
- a comma separated list of servers being added (incremental reconfiguration)leavingServers
- a comma separated list of servers being removed (incremental reconfiguration)newMembers
- a comma separated list of new membership (non-incremental reconfiguration)fromConfig
- version of the current configuration
(optional - causes reconfiguration to throw an exception if configuration is no longer current)stat
- the stat of /zookeeper/config znode will be copied to this
parameter if not null.java.lang.InterruptedException
- If the server transaction is interrupted.KeeperException
- If the server signals an error with a non-zero error code.public byte[] reconfigure(java.util.List<java.lang.String> joiningServers, java.util.List<java.lang.String> leavingServers, java.util.List<java.lang.String> newMembers, long fromConfig, Stat stat) throws KeeperException, java.lang.InterruptedException
KeeperException
java.lang.InterruptedException
reconfigure(java.lang.String, java.lang.String, java.lang.String, long, org.apache.zookeeper.data.Stat)
public void reconfigure(java.lang.String joiningServers, java.lang.String leavingServers, java.lang.String newMembers, long fromConfig, AsyncCallback.DataCallback cb, java.lang.Object ctx)
public void reconfigure(java.util.List<java.lang.String> joiningServers, java.util.List<java.lang.String> leavingServers, java.util.List<java.lang.String> newMembers, long fromConfig, AsyncCallback.DataCallback cb, java.lang.Object ctx)
Copyright © 2018 The Apache Software Foundation