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

register() blocks on a selector blocked on select()

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Not an Issue
    • P5
    • None
    • 6
    • core-libs
    • x86
    • windows_xp

    Description

      A DESCRIPTION OF THE REQUEST :
      The API documentation never notes that a register() can block.

      JUSTIFICATION :
      The API should make a note of this... otherwise, a developer will only notice this by accident (i.e. the application locks up and makes no progress).

      An alternative which is a bit harder is to make register() non-blocking (this would be ideal).

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The documentation should be updated to make a note of the behavior, or the implementation changed so that register() does not block.
      ACTUAL -
      Trying to register() a SocketChannel on a selector that is blocked in a select() will result in register() hanging until the selector wakes up.

      CUSTOMER SUBMITTED WORKAROUND :
      Use select() with a timeout and hope the thread running register() makes progress (this is a potential race), or build a Queue of Runnables that perform the appropriate registrations that the selection thread can run before entering the next select.

      Attachments

        Activity

          People

            Unassigned Unassigned
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: