Package org.bitcoinj.net
Class SocketTimeoutTask
java.lang.Object
org.bitcoinj.net.SocketTimeoutTask
- All Implemented Interfaces:
TimeoutHandler
Component that implements the timeout capability of
TimeoutHandler
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
setSocketTimeout
(Duration timeout) Sets the receive timeout, automatically killing the connection if no messages are received for this longfinal void
setTimeoutEnabled
(boolean timeoutEnabled) Enables or disables the timeout entirely.
-
Constructor Details
-
SocketTimeoutTask
-
-
Method Details
-
setTimeoutEnabled
public final 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 timeout to be set to
Duration.ZERO
(ie disabled).This call will reset the current progress towards the timeout.
- Specified by:
setTimeoutEnabled
in interfaceTimeoutHandler
-
setSocketTimeout
Sets the receive timeout, automatically killing the connection if no messages are received for this long
A timeout of
Duration.ZERO
is interpreted as no timeout.The default is for timeoutEnabled to be true but timeout to be set to
Duration.ZERO
(ie disabled).This call will reset the current progress towards the timeout.
- Specified by:
setSocketTimeout
in interfaceTimeoutHandler
-