- All Known Subinterfaces:
RouterApp
- All Known Implementing Classes:
Analysis, ConsoleUpdateManager, ExternalMain, GraphGenerator, I2PControlController, JettyStart, Main, NavHelper, NewsManager, RouterConsoleRunner, SAMBridge, ShellService, SnarkManager, SocketController, TunnelControllerGroup, UrlLauncher
public interface ClientApp
If a class started via
clients.config implements this interface, it will be used to manage the client, instead of starting with main()Clients implementing this interface MUST provide the following constructor:
public MyClientApp(I2PAppContext context, ClientAppManager listener, String[] args) {...}
All parameters are non-null. This constructor is for instantiation only. Do not take a long time. Do not block. Never start threads or processes in it. The ClientAppState of the returned object must be INITIALIZED, or else throw something. The startup() method will be called next.
Never ever hold a static reference to the context or anything derived from it.
Method Details
startup
Do not take a long time. Do not block. Start threads here if necessary. Client must callClientAppManager.notify(ClientApp, ClientAppState, String, Exception)at least once within this method to change the state from INITIALIZED to something else. Will not be called multiple times on the same object.- Throws:
Throwable- on startup failure
shutdown
Do not take a long time. Do not block. Use a thread if necessary. If previously running, client must callClientAppManager.notify(ClientApp, ClientAppState, String, Exception)at least once within this method to change the state to STOPPING or STOPPED. May be called multiple times on the same object, in any state.- Parameters:
args- generally null but could be stopArgs fromclients.config- Throws:
Throwable- on shutdown failure
getState
getName
String getName()The generic name of the ClientApp, used for registration, e.g. "console". Do not translate.- Returns:
- non-null
getDisplayName
String getDisplayName()The display name of the ClientApp, used in user interfaces. The app must translate.- Returns:
- non-null