java.lang.Object
net.i2p.router.JobImpl
net.i2p.router.startup.LoadClientAppsJob
- All Implemented Interfaces:
Job
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.Nested Class Summary
Modifier and TypeClassDescriptionstatic classPublic for router console only, not for use by others, subject to change.private static final classRunner that loads and starts one client app.private static classJob waiting for the netdb before loading a client.Field Summary
FieldsConstructor Summary
ConstructorsConstructorDescriptionCreates the job that loads and starts the configured client apps.Method Summary
Modifier and TypeMethodDescriptiongetName()Name of this job.static String[]Parse arg string into an array of args.static voidRun client in a new thread.static voidrunClient(String className, String clientName, String[] args, RouterContext ctx, Log log, ThreadGroup threadGroup, ClassLoader cl) Run client in a new thread.static voidrunClientInline(String className, String clientName, String[] args, Log log) Run client in this thread.static voidrunClientInline(String className, String clientName, String[] args, Log log, ClassLoader cl) Run client in this thread.voidrunJob()Load and start the client applications configured inclients.config.static voidtestClient(String className, ClassLoader cl) Use to test if the class is present, to propagate an error back to the user, sincerunClient(String, String, String[], RouterContext, Log)runs in a separate thread.Methods inherited from class JobImpl
dropped, getContext, getJobId, getMadeReadyOn, getTiming, madeReady, requeue, toStringModifier and TypeMethodDescriptionvoiddropped()Default implementation does nothing.final RouterContextThe router context that this job belongs to.longgetJobId()The unique job ID for this job.longThe timestamp when this job was last made ready for execution.The timing object for this job.voidmadeReady(long now) For JobQueue only, not for external use.protected voidrequeue(long delayMs) Requeue this job to run after the specified delay.toString()
Field Details
_log
Logger for the client app loading._loaded
private static boolean _loadedTrue once the client apps have been loaded.
Constructor Details
LoadClientAppsJob
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 inclients.config.parseArgs
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
Use to test if the class is present, to propagate an error back to the user, sincerunClient(String, String, String[], RouterContext, Log)runs in a separate thread.- Parameters:
className- the client class to check forcl- 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 nullargs- can be nulllog- 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 nullargs- can be nulllog- the log the client application writes its startup messages tocl- 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 nullargs- can be nullctx- the router context passed through to the client applicationlog- 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 nullargs- can be nullctx- the router context passed through to the client applicationlog- the log the client application writes its startup messages tothreadGroup- can be nullcl- can be null
getName