Shutdown from EDT Thread

I’m using an AWTPanel in order to integrate a JMonkey display (a SimpleApp that works with an AWTPanel) with a larger swing application. This is a simulation application where the user can start, stop a simulation run. The displays are created each simulation run and destroyed when the run is finished. Typically, a display is destroyed in response to a button press and so the destroy is at least begun in Swing’s EDT. With this in mind, I’ve two questions:

  1. What’s the appropriate way to destroy and clean up a SimpleApp and the AWTPanel?
  2. Given that this process will at least begin on the EDT thread are there any threading concerns – for example, should I enqueue a call to SimpleApp.stop() or is it OK to call that on the EDT thread.

Thanks,

Nick

http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/core/com/jme3/app/Application.java#471
http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/core/com/jme3/app/Application.java#482
http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/lwjgl/com/jme3/system/lwjgl/LwjglAbstractDisplay.java#265

Looks thread safe to me.