r/JavaFX • • Dec 07 '23

Help Any way to monitor JavaFX thread

I'm trying to write some code that will monitor the JavaFX Application Thread so that I can find out what events take longer than some given time.

If an event takes longer than X seconds, I want to know what it was, and ideally get the stack trace of that moment.

I've been able to do it with Swing and the EDT via http://www.java2s.com/Code/Java/Event/MonitorstheAWTeventdispatchthreadforeventsthattakelongerthanacertaintimetobedispatched.htm

But I cannot figure out something similar for JavaFX. It seems like a basic feature so I'm surprised I can't find anything online about this.

My program uses both Swing and JavaFX, primarily Swing. I only recently started to use JavaFX so everything is done using JFXPanel bases.

Thanks.

4 Upvotes

5 comments sorted by

View all comments

Show parent comment

2

u/PrototypeMale Dec 08 '23

Nothing is on fire, we're trying to avoid any bad practices.

We don't currently have performance issues, but would love to have this profiler ready to catch any.

There are lots of developers on the same project, so there's a higher chance than usual that eventually someone puts something on the JavaFX app thread that shouldn't be there.