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
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
-
Constructor Summary
ModifierConstructorDescriptionprotected
I2PTunnelTask
(String name, EventDispatcher notifyThis, I2PTunnel tunnel) -
Method Summary
Modifier and TypeMethodDescriptionabstract 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()
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
void
setId
(int id) protected void
void
for apps that use multiple I2PTunnel instancestoString()
Methods inherited from class net.i2p.util.EventDispatcherImpl
attachEventDispatcher, detachEventDispatcher, getEventDispatcher, getEvents, getEventValue, ignoreEvents, notifyEvent, unIgnoreEvents, waitEventValue
-
Field Details
-
open
protected volatile boolean open
-
-
Constructor Details
-
I2PTunnelTask
-
-
Method Details
-
setTunnel
for apps that use multiple I2PTunnel instances -
getTunnel
-
getId
public int getId() -
isOpen
public boolean isOpen() -
setId
public void setId(int id) -
setName
-
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
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
For tasks that don't call I2PTunnel.addSession() directly- Since:
- 0.8.13
-
disconnected
-
errorOccurred
Does nothing here. Extending classes may override. -
reportAbuse
Does nothing here. Extending classes may override. -
toString
-