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

(se) Selector implementations do not need to use cancelledKeys

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P4
    • 14
    • None
    • core-libs
    • b17

    Description

      A long standing complaint is that using the Selector API can involve a lot of short lived objects and GC. JDK-8199433 added new APIs in Java SE 11 to invoke an action with the selected keys rather than adding it to the selected-key set and that eliminated most of the issue for code that migrates to the newer API. One remaining issue is the cancelled key set. When a key is cancelled it is added to this set for the next selection operation. The cancelled key set is not accessible (except to custom Selector implementations) so there is scope to replace this usage.

      Attachments

        Activity

          People

            alanb Alan Bateman
            alanb Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: