SwingUtilities.invokeLater(Runnable) analogue in jMonkey

Swing is thread unsafe just as jMonkey. Swing uses SwingUtilities.invokeLater(Runnable) to enqueue state updates pulled from other threads into SDT loop.

I’d like to run jMonkey in separate trait and I’m searching for thread-safe communication means. There is application.enqueue() that sounds right but in fact just starts new subthread with inefficient realization of STM in it, and that is not what I need. What is the recommended way to schedule updates in update loop? Should I write mutex functionality manually or can I activate engine embedded functionality?



https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:multithreading covers inverse situation, when jmonkey application is main thread of the application, but I need to keep major other thread.

Application.enqueue() runs things on the OpenGL thread. I’m not sure where you got the idea that it creates its own thread. It is exactly the same as SwingUtilitis.invokeLater() except on a different thread.

the provided manual states:

Use the execution queue application.enqueue() to create a sub-thread that clones the info. Only disadvantage is, it may be slower.

I've missed point that the enqueue method doesn't create subthread itself but make communication with other threads available.