Commands (Apache ZooKeeper - Server 3.7.0 API)
Date: 2021-03-17

org.apache.zookeeper.server.admin

## Class Commands

- java.lang.Object
- - org.apache.zookeeper.server.admin.Commands

-     public class Commands
      extends Object

  Class containing static methods for registering and running Commands, as well as default Command definitions.
  See Also:
    `Command`, `JettyAdminServer`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Commands.CnxnStatResetCommand` Reset all connection statistics.
    `static class` | `Commands.ConfCommand` Server configuration parameters.
    `static class` | `Commands.ConsCommand` Information on client connections to server.
    `static class` | `Commands.DigestCommand` Digest histories for every specific number of txns.
    `static class` | `Commands.DirsCommand` Information on ZK datadir and snapdir size in bytes
    `static class` | `Commands.DumpCommand` Information on session expirations and ephemerals.
    `static class` | `Commands.EnvCommand` All defined environment variables.
    `static class` | `Commands.GetTraceMaskCommand` The current trace mask.
    `static class` | `Commands.InitialConfigurationCommand`
    `static class` | `Commands.IsroCommand` Is this server in read-only mode.
    `static class` | `Commands.LastSnapshotCommand` Command returns information of the last snapshot that zookeeper server has finished saving to disk.
    `static class` | `Commands.LeaderCommand` Returns the leader status of this instance and the leader host string.
    `static class` | `Commands.MonitorCommand` Some useful info for monitoring.
    `static class` | `Commands.ObserverCnxnStatResetCommand` Reset all observer connection statistics.
    `static class` | `Commands.RuokCommand` No-op command, check if the server is running
    `static class` | `Commands.SetTraceMaskCommand` Sets the trace mask.
    `static class` | `Commands.SrvrCommand` Server information.
    `static class` | `Commands.StatCommand` Same as SrvrCommand but has extra "connections" entry.
    `static class` | `Commands.StatResetCommand` Resets server statistics.
    `static class` | `Commands.SyncedObserverConsCommand` Information on observer connections to server.
    `static class` | `Commands.SystemPropertiesCommand` All defined system properties.
    `static class` | `Commands.VotingViewCommand` Returns the current ensemble configuration information.
    `static class` | `Commands.WatchCommand` Watch information aggregated by session.
    `static class` | `Commands.WatchesByPathCommand` Watch information aggregated by path.
    `static class` | `Commands.WatchSummaryCommand` Summarized watch information.
    `static class` | `Commands.ZabStateCommand` Returns the current phase of Zab protocol that peer is running.

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Command` | `getCommand(String cmdName)` Returns the commands registered under cmdName with registerCommand, or null if no command is registered with that name.
    `static Set<String>` | `getPrimaryNames()` Returns the primary names of all registered commands.
    `static void` | `registerCommand(Command command)` Registers the given command.
    `static CommandResponse` | `runCommand(String cmdName, ZooKeeperServer zkServer, Map<String,String> kwargs)` Run the registered command with name cmdName.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### registerCommand

          public static void registerCommand(Command command)

      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

          public static Set<String> getPrimaryNames()

      Returns the primary names of all registered commands.

    - #### getCommand

          public static Command getCommand(String cmdName)

      Returns the commands registered under cmdName with registerCommand, or null if no command is registered with that name.

Copyright © 2008–2021 The Apache Software Foundation. All rights reserved.