public class SocketTimeout extends SimpleTimer2.TimedEvent
_state, DEFAULT_FUZZ
Constructor and Description |
---|
SocketTimeout(long delay) |
SocketTimeout(Socket socket,
long delay)
If socket is non-null, or is set later by setSocket(),
it will be closed when the timer expires.
|
Modifier and Type | Method and Description |
---|---|
boolean |
cancel()
Change in return value from void to boolean in
0.9.3 accidentally broke Syndie, sorry.
|
void |
resetTimer()
Call when there is activity
|
void |
setInactivityTimeout(long delay)
Changes the delay provided in the constructor
|
void |
setSocket(Socket s)
If non-null, will be closed when the timer expires.
|
void |
setTimeoutCommand(Runnable job)
If non-null, will be run when the timer expires.
|
void |
setTotalTimeoutPeriod(long timeoutPeriod)
If greater than zero, must be greater than the inactivity timeout.
|
void |
timeReached()
Simple interface for events to be queued up and notified on expiration
the time requested has been reached (this call should NOT block,
otherwise the whole SimpleTimer gets backed up)
|
String |
toString() |
forceReschedule, reschedule, reschedule, run, schedule, setFuzz
public SocketTimeout(long delay)
delay
- The inactivity delay, greater than zeropublic SocketTimeout(Socket socket, long delay)
socket
- may be nulldelay
- The inactivity delay, greater than zeropublic void timeReached()
SimpleTimer2.TimedEvent
timeReached
in class SimpleTimer2.TimedEvent
public boolean cancel()
cancel
in class SimpleTimer2.TimedEvent
public void setSocket(Socket s)
public void resetTimer()
public void setInactivityTimeout(long delay)
delay
- greater than zeropublic void setTotalTimeoutPeriod(long timeoutPeriod)
timeoutPeriod
- Time since constructed, or less than or equal to zero to disablepublic void setTimeoutCommand(Runnable job)