Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8332512

Clarify the value type for java.net.SocketOptions.SO_LINGER

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 23
    • core-libs
    • None
    • minimal
    • This is a documentation only change which clarifies the current implementation behaviour.
    • Java API
    • SE

      Summary

      The javadoc on java.net.SocketOptions.SO_LINGER field will be updated to clarify the type of the value this field can be expected to have when used in SocketOptions.getOption() and SocketOptions.setOption() methods.

      Problem

      The SocketOptions.SO_LINGER allows for the value to be either Boolean.FALSE (when the option is disabled) or an integer representing the linger interval (when the option is enabled). This detail isn't currently explained in the field's javadoc.

      Solution

      The javadoc of the SocketOptions.SO_LINGER field will be updated to specify when the field's value will be Boolean.FALSE and when an integer.

      Specification

      /**
       * See {@link StandardSocketOptions#SO_LINGER} for description of this socket option.
       * <p>
       * Set the value to {@code Boolean.FALSE} or an integer less than {@code 0} with
       * {@link #setOption(int, Object)} to disable this option. An integer greater than or equal to
       * {@code 0} will enable the option and will represent the linger interval.
       * <p>
       * If this option is enabled then {@link #getOption(int)} will return an integer value
       * representing the linger interval, else the return value will be {@code Boolean.FALSE}.
       *
       * @see Socket#setSoLinger
       * @see Socket#getSoLinger
       */
      @Native public static final int SO_LINGER = 0x0080;

            jpai Jaikiran Pai
            jpai Jaikiran Pai
            Alan Bateman, Daniel Fuchs
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: