Modifier and Type | Class and Description |
---|---|
(package private) static class |
TunnelControllerGroup.CustomThreadPoolExecutor
Not really needed for now but in case we want to add some hooks like afterExecute().
|
Modifier and Type | Field and Description |
---|---|
(package private) static String |
DEFAULT_CONFIG_FILE |
Constructor and Description |
---|
TunnelControllerGroup(I2PAppContext context,
ClientAppManager mgr,
String[] args)
Instantiation only.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
acquire(TunnelController controller,
I2PSession session)
Note the fact that the controller is using the session so that
it isn't destroyed prematurely.
|
void |
addController(TunnelController controller)
Add the given tunnel to the set of known controllers (but dont add it to
a config file or start it or anything)
|
List<String> |
clearAllMessages()
Fetch and clear all outstanding messages from any of the known tunnels.
|
(package private) ThreadPoolExecutor |
getClientExecutor() |
I2PAppContext |
getContext()
Helper
|
List<TunnelController> |
getControllers()
Retrieve a list of tunnels known.
|
String |
getDisplayName()
ClientApp interface
|
static TunnelControllerGroup |
getInstance()
In I2PAppContext will instantiate if necessary and always return non-null.
|
static TunnelControllerGroup |
getInstance(I2PAppContext ctx)
In I2PAppContext will instantiate if necessary and always return non-null.
|
String |
getName()
ClientApp interface
|
ClientAppState |
getState()
ClientApp interface
|
void |
loadControllers(File cfgFile)
Load up all of the tunnels configured in the given file.
|
static void |
main(String[] args) |
(package private) void |
release(TunnelController controller,
I2PSession session)
Note the fact that the controller is no longer using the session, and if
no other controllers are using it, destroy the session.
|
void |
reloadControllers()
Stop all tunnels, reload config, and restart those configured to do so.
|
void |
removeConfig(TunnelController tc)
Remove the configuration of this tunnel only
|
List<String> |
removeController(TunnelController controller)
Stop and remove the given tunnel.
|
List<String> |
restartAllControllers()
Restart all tunnels.
|
void |
saveConfig()
Deprecated.
use saveConfig(TunnelController) or removeConfig(TunnelController)
|
void |
saveConfig(String cfgFile)
Deprecated.
|
void |
saveConfig(TunnelController tc)
Save the configuration of this tunnel only, may be new.
|
void |
shutdown()
Warning - destroys the singleton!
Caller must root a new context before calling instance() or main() again.
|
void |
shutdown(String[] args)
ClientApp interface
|
List<String> |
startAllControllers()
Start all tunnels.
|
void |
startup()
ClientApp interface
|
List<String> |
stopAllControllers()
Stop all tunnels.
|
void |
unloadControllers()
Stop and remove reference to all known tunnels (but dont delete any config
file or do other silly things)
|
static final String DEFAULT_CONFIG_FILE
public TunnelControllerGroup(I2PAppContext context, ClientAppManager mgr, String[] args)
mgr
- may be nullargs
- zero or one args, which may be one config file or one config
directory. If not absolute will be relative to the context's config dir,
if empty or null, the default is i2ptunnel.config for a
config file and i2ptunnel.config.d for a config directoryIllegalArgumentException
- if too many argspublic static TunnelControllerGroup getInstance()
IllegalArgumentException
- if unable to load from i2ptunnel.configpublic static TunnelControllerGroup getInstance(I2PAppContext ctx)
IllegalArgumentException
- if unable to load from i2ptunnel.configpublic static void main(String[] args)
args
- one arg, the config file, if not absolute will be relative to the context's config dir,
if no args, the default is i2ptunnel.configIllegalArgumentException
- if unable to load from config from filepublic I2PAppContext getContext()
public void startup()
startup
in interface ClientApp
IllegalArgumentException
- if unable to load config from filepublic ClientAppState getState()
public String getName()
public String getDisplayName()
getDisplayName
in interface ClientApp
public void shutdown(String[] args)
public void shutdown()
public void loadControllers(File cfgFile)
IllegalArgumentException
- if unable to load from filepublic void reloadControllers()
IllegalArgumentException
- if unable to reload config filepublic void unloadControllers()
public void addController(TunnelController controller)
public List<String> removeController(TunnelController controller)
public List<String> stopAllControllers()
public List<String> startAllControllers()
public List<String> restartAllControllers()
public List<String> clearAllMessages()
@Deprecated public void saveConfig() throws IOException
IOException
@Deprecated public void saveConfig(String cfgFile) throws IOException
IOException
public void saveConfig(TunnelController tc) throws IOException
IOException
public void removeConfig(TunnelController tc) throws IOException
IOException
public List<TunnelController> getControllers()
IllegalArgumentException
- if unable to load config from filevoid acquire(TunnelController controller, I2PSession session)
void release(TunnelController controller, I2PSession session)
ThreadPoolExecutor getClientExecutor()