Package net.i2p.i2ptunnel
Class I2PTunnelTask
- java.lang.Object
-
- net.i2p.util.EventDispatcherImpl
-
- net.i2p.i2ptunnel.I2PTunnelTask
-
- All Implemented Interfaces:
EventDispatcher
- Direct Known Subclasses:
I2PTunnelClientBase
,I2PTunnelServer
,I2PTunnelUDPClientBase
,I2PTunnelUDPServerBase
public abstract class I2PTunnelTask extends EventDispatcherImpl
Either a Server or a Client. Use caution if extending externally. This class should be maintained as a stable API, but ask to be sure. Note that there is no startRunning() method, however all extending classes implement one.
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
open
-
Constructor Summary
Constructors Modifier Constructor Description protected
I2PTunnelTask(String name, EventDispatcher notifyThis, I2PTunnel tunnel)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract boolean
close(boolean forced)
Note that the tunnel can be reopened after this by calling startRunning().void
connected(I2PSession session)
For tasks that don't call I2PTunnel.addSession() directlyboolean
destroy()
Note that the tunnel cannot be reopened after this by calling startRunning(), as it may destroy the underlying socket manager, depending on implementation.void
disconnected(I2PSession session)
void
errorOccurred(I2PSession session, String message, Throwable error)
Does nothing here.int
getId()
I2PTunnel
getTunnel()
boolean
isOpen()
void
optionsUpdated(I2PTunnel tunnel)
Notify the task that I2PTunnel's options have been updated.void
reportAbuse(I2PSession session, int severity)
Does nothing here.protected void
routerDisconnected()
void
setId(int id)
protected void
setName(String name)
void
setTunnel(I2PTunnel pTunnel)
for apps that use multiple I2PTunnel instancesString
toString()
-
Methods inherited from class net.i2p.util.EventDispatcherImpl
attachEventDispatcher, detachEventDispatcher, getEventDispatcher, getEvents, getEventValue, ignoreEvents, notifyEvent, unIgnoreEvents, waitEventValue
-
-
-
-
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)
Note that the tunnel can be reopened after this by calling startRunning(). This may not release all resources. In particular, the I2PSocketManager remains and it may have timer threads that continue running. To release all resources permanently, call destroy().- Returns:
- success
-
destroy
public boolean destroy()
Note that the tunnel cannot be reopened after this by calling startRunning(), as it may destroy the underlying socket manager, depending on implementation. This should release all resources. The implementation here simply calls close(true). Extending classes should override to release all resources.- Returns:
- success
- Since:
- 0.9.17
-
optionsUpdated
public void optionsUpdated(I2PTunnel tunnel)
Notify the task that I2PTunnel's options have been updated. Extending classes should override and call I2PTunnel.getClientOptions(), then update the I2PSocketManager. Does nothing here.- Since:
- 0.9.1
-
connected
public void connected(I2PSession session)
For tasks that don't call I2PTunnel.addSession() directly- Since:
- 0.8.13
-
disconnected
public void disconnected(I2PSession session)
-
errorOccurred
public void errorOccurred(I2PSession session, String message, Throwable error)
Does nothing here. Extending classes may override.
-
reportAbuse
public void reportAbuse(I2PSession session, int severity)
Does nothing here. Extending classes may override.
-
-