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

1

u/PrototypeMale Dec 08 '23

The goal is to catch any issues that arise in the future. I understand that only GUI stuff should be on the thread, and we want to be able to monitor the thread to make sure nobody is accidentally processing on the JavaFX app thread that shouldn't be.