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

[Concurrency] Service#running() and other convenience methods are invoked before listeners of the state property.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8u20
    • 8u5
    • javafx
    • Windows 8.1 (64bit). Java 8u5 (64bit).

      The API for Service#running() says:

      bq. This method is invoked after any listeners of the state property and after the Task has been fully transitioned to the new state.

      It's the same for scheduled(), failed(), etc.. However, all of those convenience methods run before listener notification, not after. For me, the preferred behavior is the behavior described in the API.

      Here is an SSCCE using running() as an example: http://pastebin.com/Dzr3GLj9

      Expected output:

      OS: Windows 8.1
      Version: 1.8.0_05
      VM Info: 25.5-b02 (amd64)
      ----------------------------------------
      observed RUNNING
      running()

      Actual output:

      OS: Windows 8.1
      Version: 1.8.0_05
      VM Info: 25.5-b02 (amd64)
      ----------------------------------------
      running()
      observed RUNNING

      I'm not very familiar with the way the dispatching works, but Task looks very similar and functions correctly.

      For reference, here is a similar SSCCE for Task: http://pastebin.com/1hTAJh6K

            msladecek Martin Sládeček
            rjjfx Ryan J (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: