Prioritized event handlers

Michael Strauß michaelstrau2 at gmail.com
Wed Nov 20 22:36:03 UTC 2024


Hi Andy!

> 1. Does this proposal changes the way events are dispatched with respect to priority?  In other words, does it first go through the list of all handlers registred on the leaf Node (high priority first, then lower, then lowest), then bubble up?  Or do they propagate upwards looking for high priority handlers first, then the process restarts for lower priorities, as I saw in some previous emails?  (I could be mistaken)

I think it would most likely be the latter, i.e. a separate "wave" for
each priority where the event first tunnels down to the target, and
then bubbles back up. The downside of this is the increased
implementation complexity: we probably don't want to increase the
number of events five-fold, especially when most of the time, no one
is listening anyway. So there would have to be quite a bit of
optimization to make this work efficiently.


> 2. Do you propose to abort event dispatching immediately after the event is consumed?  This probably should be mentioned earlier in the Motivation (the problem statement) section.

Yes, once an event is consumed, further dispatching stops immediately.
We also need to fix the bug that is currently in FX where that's not
the case for listeners on the same node.


The rest of the questions are very specific for prioritized event
handlers. But I now think that unconsumed event handlers are a much
simpler solution to the problem, as it solves the same set of problems
that are solved with prioritized event handlers.


More information about the openjfx-dev mailing list