java.lang.Object
net.i2p.router.JobImpl
net.i2p.router.startup.LoadClientAppsJob
All Implemented Interfaces:
Job

public class LoadClientAppsJobextends JobImpl
Run any client applications specified in clients.config. If any clientApp contains the config property ".onBoot=true" it'll be launched immediately, otherwise it'll get queued up for starting 2 minutes later.
  • Field Details

    • _log

      private final Log _log
      Logger for the client app loading.
    • _loaded

      private static boolean _loaded
      True once the client apps have been loaded.
  • Constructor Details

    • LoadClientAppsJob

      public LoadClientAppsJob(RouterContext ctx)
      Creates the job that loads and starts the configured client apps.
      Parameters:
      ctx - the router context supplying the client app config and the log
  • Method Details

    • runJob

      public void runJob()
      Load and start the client applications configured in clients.config.
    • parseArgs

      public static String[] parseArgs(String args)
      Parse arg string into an array of args. Spaces or tabs separate args. Args may be single- or double-quoted if they contain spaces or tabs. There is no provision for escaping quotes. A quoted string may not contain a quote of any kind.
      Parameters:
      args - may be null
      Returns:
      non-null, 0-length if args is null
    • testClient

      public static void testClient(String className, ClassLoader cl) throws ClassNotFoundException
      Use to test if the class is present, to propagate an error back to the user, since runClient(String, String, String[], RouterContext, Log) runs in a separate thread.
      Parameters:
      className - the client class to check for
      cl - can be null
      Throws:
      ClassNotFoundException - if the loader cannot resolve the class, so the console reports it
    • runClientInline

      public static void runClientInline(String className, String clientName, String[] args, Log log) throws Exception
      Run client in this thread. Used for plugin sub-clients only. Does not register with the ClientAppManager.
      Parameters:
      className - the client class to run, which must declare a static main(String[])
      clientName - can be null
      args - can be null
      log - the log the client application writes its startup messages to
      Throws:
      Exception - just about anything, caller would be wise to catch Throwable
    • runClientInline

      public static void runClientInline(String className, String clientName, String[] args, Log log, ClassLoader cl) throws Exception
      Run client in this thread. Used for plugin sub-clients only. Does not register with the ClientAppManager.
      Parameters:
      className - the client class to run, which must declare a static main(String[])
      clientName - can be null
      args - can be null
      log - the log the client application writes its startup messages to
      cl - can be null
      Throws:
      Exception - just about anything, caller would be wise to catch Throwable
    • runClient

      public static void runClient(String className, String clientName, String[] args, RouterContext ctx, Log log)
      Run client in a new thread.
      Parameters:
      className - the client class to run, which must declare a static main(String[])
      clientName - can be null
      args - can be null
      ctx - the router context passed through to the client application
      log - the log the client application writes its startup messages to
    • runClient

      public static void runClient(String className, String clientName, String[] args, RouterContext ctx, Log log, ThreadGroup threadGroup, ClassLoader cl)
      Run client in a new thread.
      Parameters:
      className - the client class to run, which must declare a static main(String[])
      clientName - can be null
      args - can be null
      ctx - the router context passed through to the client application
      log - the log the client application writes its startup messages to
      threadGroup - can be null
      cl - can be null
    • getName

      public String getName()
      Name of this job.
      Returns:
      the name this job is listed under in the job queue