net.i2p.i2ptunnel
public abstract class I2PTunnelTask extends Object implements EventDispatcher
Modifier and Type | Field and Description |
---|---|
protected boolean |
open |
Modifier | Constructor and Description |
---|---|
protected |
I2PTunnelTask(String name,
EventDispatcher notifyThis,
I2PTunnel tunnel) |
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
|
protected I2PTunnelTask(String name, EventDispatcher notifyThis, I2PTunnel tunnel)
public void setTunnel(I2PTunnel pTunnel)
public I2PTunnel getTunnel()
public int getId()
public boolean isOpen()
public void setId(int id)
protected void setName(String name)
protected void routerDisconnected()
public abstract boolean close(boolean forced)
public void disconnected(I2PSession session)
public void errorOccurred(I2PSession session, String message, Throwable error)
public void reportAbuse(I2PSession session, int severity)
public EventDispatcher getEventDispatcher()
EventDispatcher
this
, but YMMV).getEventDispatcher
in interface EventDispatcher
public void attachEventDispatcher(EventDispatcher e)
EventDispatcher
ev
won't reach the object calling this method).
Good luck, and beware of notification loops! :-)attachEventDispatcher
in interface EventDispatcher
e
- Event object to be attachedpublic void detachEventDispatcher(EventDispatcher e)
EventDispatcher
detachEventDispatcher
in interface EventDispatcher
e
- Event object to be detachedpublic void notifyEvent(String e, Object a)
EventDispatcher
notifyEvent
in interface EventDispatcher
e
- name of the eventa
- data being stored for that eventpublic Object getEventValue(String n)
EventDispatcher
getEventValue
in interface EventDispatcher
n
- name of the event to query forpublic Set getEvents()
EventDispatcher
getEvents
in interface EventDispatcher
public void ignoreEvents()
EventDispatcher
ignoreEvents
in interface EventDispatcher
public void unIgnoreEvents()
EventDispatcher
unIgnoreEvents
in interface EventDispatcher
public Object waitEventValue(String n)
EventDispatcher
waitEventValue
in interface EventDispatcher
n
- name of the event to wait for