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

(se spec) SelectionKey.OP_READ/OP_WRITE documentation errors

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 15
    • core-libs
    • None
    • behavioral
    • minimal
    • Changes the specification to match longstanding behavior.
    • Java API
    • SE

      Summary

      Correct the specification of SelectionKey.OP_READ and SelectionKey.OP_WRITE.

      Problem

      The specification incorrectly states that OP_READ, OP_WRITE, respectively, will be added to the key's ready-operation set when the corresponding channel has been remotely shut down for further reading, writing, respectively, when it should be the converse.

      Solution

      Change the specification to state that OP_READ, OP_WRITE, respectively, will be added to the key's ready-operation set when the corresponding channel has been remotely shut down for further writing, reading, respectively.

      Specification

      Please see also the attached webrev.

      OP_READ

      Operation-set bit for read operations.

      Suppose that a selection key's interest set contains OP_READ at the start of a selection operation. If the selector detects that the corresponding channel is ready for reading, has reached end-of-stream, has been remotely shut down for further writing, or has an error pending, then it will add OP_READ to the key's ready-operation set.

      OP_WRITE

      Operation-set bit for write operations.

      Suppose that a selection key's interest set contains OP_WRITE at the start of a selection operation. If the selector detects that the corresponding channel is ready for writing, has been remotely shut down for further reading, or has an error pending, then it will add OP_WRITE to the key's ready set.

            bpb Brian Burkhalter
            nthompsosunw Nathanael Thompson (Inactive)
            Alan Bateman, Lance Andersen, Roger Riggs
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: