java.lang.Object
net.i2p.i2pcontrol.servlets.jsonrpc2handlers.RouterManagerHandler
- All Implemented Interfaces:
RequestHandler
JSON-RPC2 handler for the RouterManager method. Controls router operations including shutdown, restart, graceful shutdown, graceful restart, reseeding, and update management.
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classTask to update the wrapper manager with a specific exit codeField Summary
FieldsModifier and TypeFieldDescriptionprivate final RouterContextThe router being managed.private final JSONRPC2HelperReads the request's arguments.private static final LogLogger for this class.private static final intHow long the shutdown may drain, in ms.Constructor Summary
ConstructorsConstructorDescriptionRouterManagerHandler(RouterContext ctx, JSONRPC2Helper helper) Retains the router context and response helper used to serve the requests.Method Summary
Modifier and TypeMethodDescriptionString[]Method names this handler services.private JSONRPC2Responseprocess(JSONRPC2Request req) Runs the requested router management action.process(JSONRPC2Request req, MessageContext ctx) Process a RouterManager request
Field Details
_log
Logger for this class._helper
Reads the request's arguments._context
The router being managed.SHUTDOWN_WAIT
private static final int SHUTDOWN_WAITHow long the shutdown may drain, in ms.- See Also:
Constructor Details
RouterManagerHandler
Retains the router context and response helper used to serve the requests.- Parameters:
ctx- the router context whose services the managed operations act onhelper- the JSON-RPC2 helper used to build responses and check authentication
Method Details
handledRequests
Method names this handler services.- Specified by:
handledRequestsin interfaceRequestHandler- Returns:
- method names handled by this handler
process
Process a RouterManager request- Specified by:
processin interfaceRequestHandler- Parameters:
req- A valid JSON-RPC 2.0 request instance. Must not benull.ctx- Context information about the request message, may benullif undefined.- Returns:
- The resulting JSON-RPC 2.0 response. It indicates success or an error, such as METHOD_NOT_FOUND.
process
Runs the requested router management action.- Parameters:
req- the request to answer- Returns:
- the reply to send