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

(se spec) Selector spec should clarify calculation of select return value

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 19
    • core-libs
    • None
    • behavioral
    • minimal
    • Minimal risk as this merely improves the descriptions of existing entities.
    • Java API
    • SE

      Summary

      Improve the description of the return value of each of the Selector.select() methods which do not accept an action parameter.

      Problem

      The current verbiage could be more precise.

      Solution

      Update the descriptions of the aforementioned return values to be more precise.

      Specification

      --- a/src/java.base/share/classes/java/nio/channels/Selector.java
      +++ b/src/java.base/share/classes/java/nio/channels/Selector.java
      @@ -355,7 +355,8 @@ public abstract class Selector implements Closeable {
            * of the {@link #wakeup wakeup} method.  </p>
            *
            * @return  The number of keys, possibly zero, whose ready-operation sets
      -     *          were updated by the selection operation
      +     *          now indicate readiness for at least one category of operations
      +     *          for which the channel was not previously detected to be ready
            *
            * @throws  IOException
            *          If an I/O error occurs
      @@ -383,8 +384,9 @@ public abstract class Selector implements Closeable {
            *                  channel to become ready; if zero, block indefinitely;
            *                  must not be negative
            *
      -     * @return  The number of keys, possibly zero,
      -     *          whose ready-operation sets were updated
      +     * @return  The number of keys, possibly zero, whose ready-operation sets
      +     *          now indicate readiness for at least one category of operations
      +     *          for which the channel was not previously detected to be ready
            *
            * @throws  IOException
            *          If an I/O error occurs
      @@ -406,8 +408,9 @@ public abstract class Selector implements Closeable {
            * this selector's {@link #wakeup wakeup} method is invoked, or the current
            * thread is interrupted, whichever comes first.  </p>
            *
      -     * @return  The number of keys, possibly zero,
      -     *          whose ready-operation sets were updated
      +     * @return  The number of keys, possibly zero, whose ready-operation sets
      +     *          now indicate readiness for at least one category of operations
      +     *          for which the channel was not previously detected to be ready

            bpb Brian Burkhalter
            mmcclosksunw Michael Mccloskey (Inactive)
            Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: