JavaFX Application Thread is recursively re-entrant into Eventhandler handle() method under some circumstances

javafx at javafx at
Sat Sep 8 00:37:59 UTC 2018


I have a couple of very small apps (3 small classes in one case and 5 
in another)  which demonstrate that, under some circumstances, the 
JavaFX Application Thread will recursively re-enter 

So this means that it is already in handle (and calls therefrom) and 
will, in some situations not complete that  processing (thus exiting 
handle) before it reappears in the same instance of EventHandler's 
handle method again. So this is true recursion.

I actually don't know if this is expected behavior or not. No one I've 
talked to expected it; the general understanding is the JavaFX 
Application Thread (processing) is specifically single-threaded and 
also that it will defintily complete one invocation of handle() before 
beginning another one.

I have to say that there is NO other Thread  in play here, at least no 
other Thread my applications create (what's going on QuantumToolKit may 
be a different story.)

The material upshot of this is it can lead to apparent  program 
incorrectness if the dev believes that it's not the case, and 100% of 
devs I've talked to think it's not possible. 

I am happy to post or attach the classes or modules as requested but 
first I wanted to check to see if in fact this is already known to be 
true and is in fact  expected behavior, in which case it's a non-issue 
and just a subtlety people are not aware of.

Thank you so much !

More information about the openjfx-dev mailing list