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

JavaDoc example in SubmissionPublisher will potentially crash

    XMLWordPrintable

Details

    Description

      A DESCRIPTION OF THE PROBLEM :
      java.util.concurrent.SubmissionPublisher has an example class TransformProcessor. TransformProcessor.onNext() will immediately request one more item. Requesting one more before processing it may result in signal reordering.

      See [this discussion][1] which resulted in the following explanation [added to the spec][2]:

      "To avoid signal reordering caused by reentrant Subscription methods, it is strongly RECOMMENDED for synchronous Subscriber implementations to invoke Subscription methods at the very end of any signal processing."

      I.e., the call to request one more item should move to the bottom of the method implementation.

      [1]: https://github.com/reactive-streams/reactive-streams-jvm/issues/429
      [2]: https://github.com/reactive-streams/reactive-streams-jvm#2.1


      Attachments

        Activity

          People

            dl Doug Lea
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: