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

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

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 23
    • None
    • core-libs
    • b24

      The documentation for java.net.SocketOptions.SO_LINGER doesn't explain that the value type for this option is either an Integer or a Boolean. We should update it to make it clear.

      As noted by Alan in a PR ( https://git.openjdk.org/jdk/pull/18645#discussion_r1554833351 ):

      > One thing to mention about SO_LINGER is that the value of this socket option is an Integer when enabling and a Boolean when disabling. The getter works the same way. AFAIK, this was never correctly specified in SocketOptions.SO_LINGER but the examples in the setOption/getOption API docs include disabling. To notice this would require something to use a custom SocketImpl of course. So I think we need a follow-up to the change here to say that the value is Boolean.FALSE to disable (or disabled), otherwise an Integer with the linger timeout.

            jpai Jaikiran Pai
            jpai Jaikiran Pai
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: