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

(ch) Channels.newChannel() returns unsynchronized channels

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.4.0
    • core-libs
    • None
    • beta3
    • generic
    • generic

      The readable or writable channels returned by the public
      static methods named java.nio.channels.Channels.newChannel()
      return channels which are under-synchronized with respect to
      concurrent read() calls.

      The ReadableByteChannel specification requires that:

       * If one thread initiates a read operation upon a channel
       * then any other thread that attempts to initiate another read operation will
       * block until the first operation is complete.


      However, the read() method of the returned channel
      is not synchronized and an internal byte[] field which is used for
      performing IO could be left in an inconsistent state if
      the method was called in parallel by multiple threads.

      Similar issues apply to the write() method in the
      WritableByteChannel case.

            mmcclosksunw Michael Mccloskey (Inactive)
            jdn Jeffrey Nisewanger (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: