java.lang.Object
net.i2p.i2pcontrol.servlets.jsonrpc2handlers.RouterManagerHandler
All Implemented Interfaces:
RequestHandler

public class RouterManagerHandlerextends Object implements RequestHandler
JSON-RPC2 handler for the RouterManager method. Controls router operations including shutdown, restart, graceful shutdown, graceful restart, reseeding, and update management.
  • Field Details

    • _log

      private static final Log _log
      Logger for this class.
    • _helper

      private final JSONRPC2Helper _helper
      Reads the request's arguments.
    • _context

      private final RouterContext _context
      The router being managed.
    • SHUTDOWN_WAIT

      private static final int SHUTDOWN_WAIT
      How long the shutdown may drain, in ms.
      See Also:
  • Constructor Details

    • RouterManagerHandler

      public RouterManagerHandler(RouterContext ctx, JSONRPC2Helper helper)
      Retains the router context and response helper used to serve the requests.
      Parameters:
      ctx - the router context whose services the managed operations act on
      helper - the JSON-RPC2 helper used to build responses and check authentication
  • Method Details

    • handledRequests

      public String[] handledRequests()
      Method names this handler services.
      Specified by:
      handledRequests in interface RequestHandler
      Returns:
      method names handled by this handler
    • process

      public JSONRPC2Response process(JSONRPC2Request req, MessageContext ctx)
      Process a RouterManager request
      Specified by:
      process in interface RequestHandler
      Parameters:
      req - A valid JSON-RPC 2.0 request instance. Must not be null.
      ctx - Context information about the request message, may be null if undefined.
      Returns:
      The resulting JSON-RPC 2.0 response. It indicates success or an error, such as METHOD_NOT_FOUND.
    • process

      private JSONRPC2Response process(JSONRPC2Request req)
      Runs the requested router management action.
      Parameters:
      req - the request to answer
      Returns:
      the reply to send