Class SocketSettings


  • @Immutable
    public final class SocketSettings
    extends Object
    An immutable class representing socket settings used for connections to a MongoDB server.
    Since:
    3.0
    • Method Detail

      • builder

        public static SocketSettings.Builder builder()
        Gets a builder for an instance of SocketSettings.
        Returns:
        the builder
      • builder

        public static SocketSettings.Builder builder​(SocketSettings socketSettings)
        Creates a builder instance.
        Parameters:
        socketSettings - existing SocketSettings to default the builder settings on.
        Returns:
        a builder
        Since:
        3.7
      • getConnectTimeout

        public int getConnectTimeout​(TimeUnit timeUnit)
        Gets the timeout for socket connect. Defaults to 10 seconds.
        Parameters:
        timeUnit - the time unit to get the timeout in
        Returns:
        the connect timeout in the requested time unit.
      • getReadTimeout

        public int getReadTimeout​(TimeUnit timeUnit)
        Gets the timeout for socket reads. Defaults to 0, which indicates no timeout
        Parameters:
        timeUnit - the time unit to get the timeout in
        Returns:
        the read timeout in the requested time unit, or 0 if there is no timeout
      • getReceiveBufferSize

        public int getReceiveBufferSize()
        Gets the receive buffer size. Defaults to the operating system default.
        Returns:
        the receive buffer size
      • getSendBufferSize

        public int getSendBufferSize()
        Gets the send buffer size. Defaults to the operating system default.
        Returns:
        the send buffer size
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object