|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.limegroup.gnutella.uploader.StalledUploadWatchdog
Kills an OutputStream after a certain amount of time has passed.
The flow has the following methodology: When constructed, this class is inactive and does nothing. To activate the stall-checking, you must call 'activate'. When activate is called, it updates the 'check time' to be DELAY_TIME plus the current time and also schedules the task if necessary. To deactive the stall-checking, you must call 'deactivate'. Deactivate does NOT remove the task from the RouterService's schedule, but it does tell the checker to not kill the output stream when it is run.
Because the task can be reactivated without rescheduling, it is possible that RouterService may 'run' the task before the most recent delay time has expired. To counteract this, 'activate' will store the time that it expects 'run' to be called. If 'run' is called too soon, it will reschedule the task to be run at the appropriate time.
All methods are synchronized and guaranteed to not lock the timer queue.
Field Summary | |
static long |
DELAY_TIME
The amount of time to wait before we close this connection if nothing has been written to the socket. |
Constructor Summary | |
StalledUploadWatchdog()
|
Method Summary | |
void |
activate(java.io.OutputStream ostream)
Activates the checking. |
boolean |
deactivate()
Deactives the killing of the NormalUploadState |
void |
run()
Kills the upload if we're active, and tells the state to close the connection. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static long DELAY_TIME
Constructor Detail |
public StalledUploadWatchdog()
Method Detail |
public boolean deactivate()
public void activate(java.io.OutputStream ostream)
public void run()
run
in interface java.lang.Runnable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |