Interface TimeoutHandler

  • All Known Implementing Classes:
    AbstractTimeoutHandler, Peer, PeerSocketHandler, SocketTimeoutTask

    public interface TimeoutHandler
    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.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void setSocketTimeout​(java.time.Duration timeout)
      Sets the receive timeout, automatically killing the connection if no messages are received for this long
      void setTimeoutEnabled​(boolean timeoutEnabled)
      Enables or disables the timeout entirely.
    • Method Detail

      • setTimeoutEnabled

        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 0 (ie disabled).

        This call will reset the current progress towards the timeout.

      • setSocketTimeout

        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.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.