Class Commands.ShedConnectionsCommand
java.lang.Object
org.apache.zookeeper.server.admin.CommandBase
org.apache.zookeeper.server.admin.PostCommand
org.apache.zookeeper.server.admin.Commands.ShedConnectionsCommand
- All Implemented Interfaces:
Command
- Enclosing class:
- Commands
Attempts to shed approximately the specified percentage of connections.
Request: JSON input stream containing the following required field:
- "percentage": Integer [0-100] - percentage of connections to attempt shedding
value must be between 0 (no connections) and 100 (all connections).
Response: JSON output stream containing:
- "connections_shed": Integer - actual number of connections successfully closed
may vary due to randomness.
- "percentage_requested": Integer - the percentage that was requested
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionrunPost(ZooKeeperServer zkServer, InputStream inputStream) Run this command for HTTP POST.Methods inherited from class org.apache.zookeeper.server.admin.PostCommand
runGetMethods inherited from class org.apache.zookeeper.server.admin.CommandBase
getAuthRequest, getNames, getPrimaryName, initializeResponse, isServerRequired
-
Constructor Details
-
ShedConnectionsCommand
public ShedConnectionsCommand()
-
-
Method Details
-
runPost
Description copied from interface:CommandRun this command for HTTP POST. Commands take a ZooKeeperServer and InputStream and return a CommandResponse object containing any information constituting the response to the command. Commands are responsible for parsing keyword arguments and performing any error handling if necessary. Errors should be reported by setting the "error" entry of the returned map with an appropriate message rather than throwing an exception.- Parameters:
zkServer- ZooKeeper serverinputStream- InputStream from request- Returns:
- CommandResponse 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
-