<AWT Dev> [8] Review request for 8005465: [macosx] Evaluate if checking for the -XstartOnFirstThread is still needed in awt.m

Anthony Petrov anthony.petrov at oracle.com
Fri Dec 28 05:17:16 PST 2012


Please review a fix for http://bugs.sun.com/view_bug.do?bug_id=8005465 at:


With this fix AWT can be embedded into other GUI toolkits. Specifically, 
this fix is needed in order to be able to initialize and run AWT after 
an FX application has already been started.

We achieve this by:

1. Eliminating a check for the -XstartOnFirstThread presence. It doesn't 
make sense to check this flag because the AWT initializer is able to do 
its job on any thread anyway. The only change in logic is that we no 
longer call the NSApplicationLoad() function, but it isn't necessary 
since we're not going to be embedded into a Carbon app anyway - all 
modern toolkits are Cocoa-based, and we assume that the embedder has 
already created its NSApplication instance. If not, well, they'll have 
to live with the NSApplicationAWT then.

2. Introducing an AWTKeepAlive thread activated in the embedded mode 
only. This thread will send an event to the native event queue every 
500ms as long as there are active AWT objects present. This activity 
will notify the embedder toolkit that the Java application as a whole is 
still alive and needs not exit yet.

best regards,

More information about the awt-dev mailing list