java.lang.Object
net.i2p.desktopgui.router.RouterManager

public class RouterManagerextends Object
Handle communications with the router instance. See ConfigServiceHandler for best practices on stopping the router. We don't bother notifying any Wrapper instance here.
  • Constructor Details

    • RouterManager

      public RouterManager()
      The router is reached through the global I2PAppContext rather than through a field, so an instance holds nothing and start() is the only entry point.
  • Method Details

    • getAppContext

      private static I2PAppContext getAppContext()
      The running router's context, if any.
      Returns:
      non-null
    • start

      public static void start()
      Start an I2P router instance. This method has limited knowledge (there is no I2P instance running to collect information from). It determines the I2P location using the I2PAppContext.
    • restart

      public static void restart(RouterContext ctx)
      Restart the running I2P instance immediately.
      Parameters:
      ctx - the router context
    • shutDown

      public static void shutDown(RouterContext ctx)
      Stop the running I2P instance immediately.
      Parameters:
      ctx - the router context
    • restartGracefully

      public static void restartGracefully(RouterContext ctx)
      Restart the running I2P instance gracefully.
      Parameters:
      ctx - the router context
    • shutDownGracefully

      public static void shutDownGracefully(RouterContext ctx)
      Stop the running I2P instance gracefully.
      Parameters:
      ctx - the router context
    • cancelShutdown

      public static void cancelShutdown(RouterContext ctx)
      Cancel a graceful shutdown or restart.
      Parameters:
      ctx - the router context
    • isShutdownInProgress

      public static boolean isShutdownInProgress(RouterContext ctx)
      Is a graceful shutdown or restart in progress?
      Parameters:
      ctx - the router context
      Returns:
      true if a graceful shutdown or restart is in progress
    • getShutdownTimeRemaining

      public static long getShutdownTimeRemaining(RouterContext ctx)
      Get time until shutdown.
      Parameters:
      ctx - the router context
      Returns:
      -1 if no shutdown in progress, otherwise milliseconds until shutdown
    • getStatus

      public static String getStatus(RouterContext ctx)
      Get network status, untranslated.
      Parameters:
      ctx - the router context
      Returns:
      the current network status string