Class Commands
java.lang.Object
org.apache.zookeeper.server.admin.Commands
Class containing static methods for registering and running Commands, as well
as default Command definitions.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classReset all connection statistics.static classServer configuration parameters.static classInformation on client connections to server.static classDigest histories for every specific number of txns.static classInformation on ZK datadir and snapdir size in bytesstatic classInformation on session expirations and ephemerals.static classAll defined environment variables.static classThe current trace mask.static classstatic classIs this server in read-only mode.static classCommand returns information of the last snapshot that zookeeper server has finished saving to disk.static classReturns the leader status of this instance and the leader host string.static classSome useful info for monitoring.static classReset all observer connection statistics.static classNo-op command, check if the server is runningstatic classSets the trace mask.static classServer information.static classSame as SrvrCommand but has extra "connections" entry.static classResets server statistics.static classInformation on observer connections to server.static classAll defined system properties.static classReturns the current ensemble configuration information.static classWatch information aggregated by session.static classWatch information aggregated by path.static classSummarized watch information.static classReturns the current phase of Zab protocol that peer is running. -
Method Summary
Modifier and TypeMethodDescriptionstatic CommandgetCommand(String cmdName) Returns the commands registered under cmdName with registerCommand, or null if no command is registered with that name.Returns the primary names of all registered commands.static voidregisterCommand(Command command) Registers the given command.static CommandResponserunCommand(String cmdName, ZooKeeperServer zkServer, Map<String, String> kwargs) Run the registered command with name cmdName.
-
Method Details
-
registerCommand
Registers the given command. Registered commands can be run by passing any of their names to runCommand. -
runCommand
public static CommandResponse runCommand(String cmdName, ZooKeeperServer zkServer, Map<String, String> kwargs) Run the registered command with name cmdName. Commands should not produce any exceptions; any (anticipated) errors should be reported in the "error" entry of the returned map. Likewise, if no command with the given name is registered, this will be noted in the "error" entry.- Parameters:
cmdName-zkServer-kwargs- String-valued keyword arguments to the command (may be null if command requires no additional arguments)- Returns:
- Map representing response to command containing at minimum: - "command" key containing the command's primary name - "error" key containing a String error message or null if no error
-
getPrimaryNames
Returns the primary names of all registered commands. -
getCommand
Returns the commands registered under cmdName with registerCommand, or null if no command is registered with that name.
-