net.i2p.i2ptunnel

## Class I2PTunnelTask

- java.lang.Object
- - net.i2p.i2ptunnel.I2PTunnelTask

- All Implemented Interfaces:
    EventDispatcher
  Direct Known Subclasses:
    I2Ping, I2PTunnelClientBase, I2PTunnelServer, I2PTunnelUDPClientBase, I2PTunnelUDPServerBase

      public abstract class I2PTunnelTask
      extends Object
      implements EventDispatcher

  Either a Server or a Client.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `open`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `I2PTunnelTask(String name, EventDispatcher notifyThis, I2PTunnel tunnel)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `attachEventDispatcher(EventDispatcher e)` Attach an EventDispatcher object to the events dispatching chain.
    `abstract boolean` | `close(boolean forced)`
    `void` | `detachEventDispatcher(EventDispatcher e)` Detach the specified EventDispatcher object from the events dispatching chain.
    `void` | `disconnected(I2PSession session)`
    `void` | `errorOccurred(I2PSession session, String message, Throwable error)`
    `EventDispatcher` | `getEventDispatcher()` Get an object to be used to deliver events (usually `this`, but YMMV).
    `Set` | `getEvents()` Retrieve the names of all the events that have been received
    `Object` | `getEventValue(String n)` Retrieve the value currently associated with the specified event value
    `int` | `getId()`
    `I2PTunnel` | `getTunnel()`
    `void` | `ignoreEvents()` Ignore further event notifications
    `boolean` | `isOpen()`
    `void` | `notifyEvent(String e, Object a)` Deliver an event
    `void` | `reportAbuse(I2PSession session, int severity)`
    `protected void` | `routerDisconnected()`
    `void` | `setId(int id)`
    `protected void` | `setName(String name)`
    `void` | `setTunnel(I2PTunnel pTunnel)` for apps that use multiple I2PTunnel instances
    `String` | `toString()`
    `void` | `unIgnoreEvents()` Almost like the method above :-)
    `Object` | `waitEventValue(String n)` Wait until the given event has received a value

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### open

          protected boolean open

  - ### Constructor Detail

    - #### I2PTunnelTask

          protected I2PTunnelTask(String name,
                       EventDispatcher notifyThis,
                       I2PTunnel tunnel)

  - ### Method Detail

    - #### setTunnel

          public void setTunnel(I2PTunnel pTunnel)

      for apps that use multiple I2PTunnel instances

    - #### getTunnel

          public I2PTunnel getTunnel()

    - #### getId

          public int getId()

    - #### isOpen

          public boolean isOpen()

    - #### setId

          public void setId(int id)

    - #### setName

          protected void setName(String name)

    - #### routerDisconnected

          protected void routerDisconnected()

    - #### close

          public abstract boolean close(boolean forced)

    - #### disconnected

          public void disconnected(I2PSession session)

    - #### errorOccurred

          public void errorOccurred(I2PSession session,
                           String message,
                           Throwable error)

    - #### reportAbuse

          public void reportAbuse(I2PSession session,
                         int severity)

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### getEventDispatcher

          public EventDispatcher getEventDispatcher()

      Description copied from interface: `EventDispatcher`
      Get an object to be used to deliver events (usually `this`, but YMMV).
      Specified by:
        `getEventDispatcher` in interface `EventDispatcher`

    - #### attachEventDispatcher

          public void attachEventDispatcher(EventDispatcher e)

      Description copied from interface: `EventDispatcher`
      Attach an EventDispatcher object to the events dispatching chain. Note that notification is not bidirectional (i.e. events notified to `ev` won't reach the object calling this method). Good luck, and beware of notification loops! :-)
      Specified by:
        `attachEventDispatcher` in interface `EventDispatcher`
      Parameters:
        `e` - Event object to be attached

    - #### detachEventDispatcher

          public void detachEventDispatcher(EventDispatcher e)

      Description copied from interface: `EventDispatcher`
      Detach the specified EventDispatcher object from the events dispatching chain.
      Specified by:
        `detachEventDispatcher` in interface `EventDispatcher`
      Parameters:
        `e` - Event object to be detached

    - #### notifyEvent

          public void notifyEvent(String e,
                         Object a)

      Description copied from interface: `EventDispatcher`
      Deliver an event
      Specified by:
        `notifyEvent` in interface `EventDispatcher`
      Parameters:
        `e` - name of the event
        `a` - data being stored for that event

    - #### getEventValue

          public Object getEventValue(String n)

      Description copied from interface: `EventDispatcher`
      Retrieve the value currently associated with the specified event value
      Specified by:
        `getEventValue` in interface `EventDispatcher`
      Parameters:
        `n` - name of the event to query for
      Returns:
        value (or null if none are available)

    - #### getEvents

          public Set getEvents()

      Description copied from interface: `EventDispatcher`
      Retrieve the names of all the events that have been received
      Specified by:
        `getEvents` in interface `EventDispatcher`
      Returns:
        A set of event names

    - #### ignoreEvents

          public void ignoreEvents()

      Description copied from interface: `EventDispatcher`
      Ignore further event notifications
      Specified by:
        `ignoreEvents` in interface `EventDispatcher`

    - #### unIgnoreEvents

          public void unIgnoreEvents()

      Description copied from interface: `EventDispatcher`
      Almost like the method above :-)
      Specified by:
        `unIgnoreEvents` in interface `EventDispatcher`

    - #### waitEventValue

          public Object waitEventValue(String n)

      Description copied from interface: `EventDispatcher`
      Wait until the given event has received a value
      Specified by:
        `waitEventValue` in interface `EventDispatcher`
      Parameters:
        `n` - name of the event to wait for
      Returns:
        value specified for that event