Package com.tuladb

Record Class LedgerClient.Timeouts

java.lang.Object
java.lang.Record
com.tuladb.LedgerClient.Timeouts
Enclosing class:
LedgerClient

public static record LedgerClient.Timeouts(int connectMs, int readMs, int writeMs) extends Record
Socket timeouts, in milliseconds. Matches the C SDK's connect_timeout_ms / read_timeout_ms / write_timeout_ms.
  • connectMs bounds the TCP connect. 0 (or less) means the default, 30 000 ms, as in the C SDK: a dial is never unbounded.
  • readMs bounds each wait for reply bytes (the socket's SO_TIMEOUT): a reply that keeps arriving is not cut off. 0 = no limit.
  • writeMs bounds each wait for the peer to drain what we send, per 16 KiB chunk. 0 = no limit.

The TLS handshake is bounded in total, from its start, by the larger of readMs and writeMs (each of its reads also by readMs); with both 0 it is unbounded.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Timeouts(int connectMs, int readMs, int writeMs)
    Creates an instance of a Timeouts record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the value of the connectMs record component.
    30 s connect, read and write: the C SDK's defaults.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    of(int ms)
    The same value for all three: what the legacy int timeoutMs constructors use, so they now bound writes as well as reads.
    int
    Returns the value of the readMs record component.
    final String
    Returns a string representation of this record class.
    int
    Returns the value of the writeMs record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • Timeouts

      public Timeouts(int connectMs, int readMs, int writeMs)
      Creates an instance of a Timeouts record class.
      Parameters:
      connectMs - the value for the connectMs record component
      readMs - the value for the readMs record component
      writeMs - the value for the writeMs record component
  • Method Details

    • defaults

      public static LedgerClient.Timeouts defaults()
      30 s connect, read and write: the C SDK's defaults.
    • of

      public static LedgerClient.Timeouts of(int ms)
      The same value for all three: what the legacy int timeoutMs constructors use, so they now bound writes as well as reads.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • connectMs

      public int connectMs()
      Returns the value of the connectMs record component.
      Returns:
      the value of the connectMs record component
    • readMs

      public int readMs()
      Returns the value of the readMs record component.
      Returns:
      the value of the readMs record component
    • writeMs

      public int writeMs()
      Returns the value of the writeMs record component.
      Returns:
      the value of the writeMs record component