Package org.bitcoinj.net
Class SocketTimeoutTask
- java.lang.Object
-
- org.bitcoinj.net.SocketTimeoutTask
-
- All Implemented Interfaces:
TimeoutHandler
public class SocketTimeoutTask extends java.lang.Object implements TimeoutHandler
Component that implements the timeout capability ofTimeoutHandler.
-
-
Constructor Summary
Constructors Constructor Description SocketTimeoutTask(java.lang.Runnable actualTask)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidsetSocketTimeout(java.time.Duration timeout)Sets the receive timeout, automatically killing the connection if no messages are received for this longvoidsetTimeoutEnabled(boolean timeoutEnabled)Enables or disables the timeout entirely.
-
-
-
Method Detail
-
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:
setTimeoutEnabledin interfaceTimeoutHandler
-
setSocketTimeout
public final void setSocketTimeout(java.time.Duration timeout)
Sets the receive timeout, automatically killing the connection if no messages are received for this long
A timeout of
Duration.ZEROis 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:
setSocketTimeoutin interfaceTimeoutHandler
-
-