|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.bitcoin.net.AbstractTimeoutHandler
public abstract class AbstractTimeoutHandler
A base class which provides basic support for socket timeouts. It is used instead of integrating timeouts into the NIO select thread both for simplicity and to keep code shared between NIO and blocking sockets as much as possible.
| Constructor Summary | |
|---|---|
AbstractTimeoutHandler()
|
|
| Method Summary | |
|---|---|
protected void |
resetTimeout()
Resets the current progress towards timeout to 0. |
void |
setSocketTimeout(int timeoutMillis)
Sets the receive timeout to the given number of milliseconds, automatically killing the connection if no messages are received for this long |
void |
setTimeoutEnabled(boolean timeoutEnabled)
Enables or disables the timeout entirely. |
protected abstract void |
timeoutOccurred()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractTimeoutHandler()
| Method Detail |
|---|
public void setTimeoutEnabled(boolean timeoutEnabled)
Enables or disables the timeout entirely. This may be useful if you want to store the timeout value but wish to temporarily disable/enable timeouts.
The default is for timeoutEnabled to be true but timeoutMillis to be set to 0 (ie disabled).
This call will reset the current progress towards the timeout.
public void setSocketTimeout(int timeoutMillis)
Sets the receive timeout to the given number of milliseconds, automatically killing the connection if no messages are received for this long
A timeout of 0 is interpreted as no timeout.
The default is for timeoutEnabled to be true but timeoutMillis to be set to 0 (ie disabled).
This call will reset the current progress towards the timeout.
protected void resetTimeout()
protected abstract void timeoutOccurred()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||