Class SocketTimeoutTask

java.lang.Object
org.bitcoinj.net.SocketTimeoutTask
All Implemented Interfaces:
TimeoutHandler

public class SocketTimeoutTask extends Object implements TimeoutHandler
Component that implements the timeout capability of TimeoutHandler.
  • Constructor Details

    • SocketTimeoutTask

      public SocketTimeoutTask(Runnable actualTask)
  • 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 interface TimeoutHandler
    • setSocketTimeout

      public final void setSocketTimeout(Duration timeout)

      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 interface TimeoutHandler