## net.i2p.i2ptunnel
Class TunnelControllerGroup

    java.lang.Object
      net.i2p.i2ptunnel.TunnelControllerGroup

    public class TunnelControllerGroup

extends Object

Coordinate a set of tunnels within the JVM, loading and storing their config to disk, and building new ones as requested. Warning - this is a singleton. Todo: fix

Field Summary
`(package private) static String` `DEFAULT_CONFIG_FILE`

Method Summary
`(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 all outstanding messages from any of the known tunnels
`List<TunnelController>` `getControllers()` Retrieve a list of tunnels known
`static TunnelControllerGroup` `getInstance()`
`void` `loadControllers(String configFile)` Load up all of the tunnels configured in the given file (but do not start them)
`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()`
`List<String>` `removeController(TunnelController controller)` Stop and remove the given tunnel
`List<String>` `restartAllControllers()` Restart all tunnels
`void` `saveConfig()` Save the configuration of all known tunnels to the default config file
`void` `saveConfig(String configFile)` Save the configuration of all known tunnels to the given file
`List<String>` `startAllControllers()` Start all tunnels
`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)

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_CONFIG_FILE

    static final String DEFAULT_CONFIG_FILE

See Also:
  Constant Field Values

Method Detail

### getInstance

    public static TunnelControllerGroup getInstance()

### main

    public static void main(String[] args)

### loadControllers

    public void loadControllers(String configFile)

  Load up all of the tunnels configured in the given file (but do not start them)

### reloadControllers

    public void reloadControllers()

### unloadControllers

    public void unloadControllers()

  Stop and remove reference to all known tunnels (but dont delete any config file or do other silly things)

### addController

    public 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)

### removeController

    public List<String> removeController(TunnelController controller)

  Stop and remove the given tunnel

  Returns:
    list of messages from the controller as it is stopped

### stopAllControllers

    public List<String> stopAllControllers()

  Stop all tunnels

  Returns:
    list of messages the tunnels generate when stopped

### startAllControllers

    public List<String> startAllControllers()

  Start all tunnels

  Returns:
    list of messages the tunnels generate when started

### restartAllControllers

    public List<String> restartAllControllers()

  Restart all tunnels

  Returns:
    list of messages the tunnels generate when restarted

### clearAllMessages

    public List<String> clearAllMessages()

  Fetch all outstanding messages from any of the known tunnels

  Returns:
    list of messages the tunnels have generated

### saveConfig

    public void saveConfig()
                    throws IOException

  Save the configuration of all known tunnels to the default config file

  Throws:
    `IOException`

### saveConfig

    public void saveConfig(String configFile)
                    throws IOException

  Save the configuration of all known tunnels to the given file

  Throws:
    `IOException`

### getControllers

    public List<TunnelController> getControllers()

  Retrieve a list of tunnels known

  Returns:
    list of TunnelController objects

### acquire

    void acquire(TunnelController controller,
                 I2PSession session)

  Note the fact that the controller is using the session so that it isn't destroyed prematurely.

### release

    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.