Questions about Platform.runLater() and Application.start()

ngalarneau at ABINITIO.COM ngalarneau at ABINITIO.COM
Wed Nov 5 16:18:37 UTC 2014


Steve,

Thank you for that important addition.

Is it true that this, also, is not a special case?

In other words, is this how it works?
 - the input queue contains both Events and Runnables (from runLater() and 
the first one containing a call to Application.start())
 - one item is processed from the input queue at a time
 - if the processing of that item does a Dialog.showAndWait(), then:
 - - the processing of that item is suspended (the thread blocks?) until 
showAndWait() returns and
 - - a new item processor picks the next item off of the input queue & 
starts processing it

It looks like the "JavaFX Application Thread" is the item processor.


Neil




From:   Stephen F Northover <steve.x.northover at oracle.com>
To:     ngalarneau at ABINITIO.COM, openjfx-dev at openjdk.java.net, 
Date:   11/03/2014 09:58 AM
Subject:        Re: Questions about Platform.runLater() and 
Application.start()



Hi there,

If you en-queue a runnable in start() it will not run until start() 
completes unless you open a dialog in start() that waits for a result 
before proceeding.  In that case, your runnable will run. You are 
correct about runnables and input events being part of the input queue 
for the application thread.  Threads are not interrupted to run code.

Steve

On 2014-11-03, 8:49 AM, ngalarneau at ABINITIO.COM wrote:
> Hello,
>
> Is there documentation that describes somewhere how Platform.runLater() 
&
> Application.start() interact?
>
> My impression is that (roughly speaking):
>   - there is an EventQueue (to use the Swing terminology).
>   - the EventQueue holds both UI events (like mouse click) as well as 
the
> Runnables enqueued by runLater().
>   - the first (?) event put in the EventQueue is a Runnable representing
> Application.start().
>
>
> My impression is, therefore, that any Runnables enqueued during
> Application.start() won't be run until after start() completes.
> This behavior is the same as one runLater() not interrupting another
> runLater().
>
>
> Is this sort of stuff documented somewhere?
>
> Is this the right way to think about this part of the system? (even if 
the
> implementation is different)
>
> Are there other special things to be aware of about Application.start()?
>
>
> Thanks,
>
> Neil
>
> P.S. I am using javafx.concurrent.Service & Task and am hitting some
> issues.
>


 
NOTICE from Ab Initio: This email (including any attachments) may contain 
information that is subject to confidentiality obligations or is legally 
privileged, and sender does not waive confidentiality or privilege. If 
received in error, please notify the sender, delete this email, and make 
no further use, disclosure, or distribution. 


More information about the openjfx-dev mailing list