Well, yes. In fact, we don't add the loop observers since 7u6 (see 7144542), so my fix implements the same behavior for JDK 8 as well.

Actually, AWT doesn't need run loop observers in the headless mode. An app using the headless AWT controls when it should exit, not the AWTAutoShutdown. In some cases the native event loop may not even be running in the headless mode. At least AWT itself never runs it, so there's nothing to observe actually. The event loop is running when a headless AWT is embedded into another GUI toolkit (FX or SWT), but again AWT itself in the headless mode doesn't care about the run loop business.

Given that the fix has been in the wild since 7u6 and no bugs have been identified, I assume this is a safe change.

--
best regards,
Anthony

On 1/16/2013 18:24, Artem Ananiev wrote:

On 1/15/2013 8:27 PM, Anthony Petrov wrote:
Hi Artem,

I've split the setUpAWTAppKit() to setUpAWTAppKit() and
setUpAppKitThreadName() (and also a separate call to
NSSetUncaughtExceptionHandler() in the very beginning of -starter:.) If
you examine the logic in starter: carefully, you may notice that all the
required operations are performed just as before based on the current
mode of execution.

Before the fix, setUpAWTAppKit() is called from -starter: regardless of "headless" value.

After the fix, setUpAppKitThreadName() is called in headless mode, and both setUpAWTAppKit() and setUpAppKitThreadName() in headful mode.

The difference is than after the fix we don't add loop observers in headless mode. Is it intentional?

Thanks,

Artem

In particular, in the headless mode we want to only set the AppKit
thread name and only if we're not running in the "swt compatible mode".
We don't use observers in the headless mode. Also, the uncaught
exception handler is always set unconditionally.

--
best regards,
Anthony

On 1/15/2013 20:11, Artem Ananiev wrote:
Hi, Anthony,

after the fix, setUpAWTAppKit() is not called in headless mode, while
it was before. Could it be a problem?

Thanks,

Artem

On 1/15/2013 7:54 PM, Anthony Petrov wrote:
Hello,

After discussing this fix off-line, we decided to start off with a
minimal version of the fix that enables FX and AWT to run in headful
mode, and be able to be initialized in any order. The new fix for
http://bugs.sun.com/view_bug.do?bug_id=8005465 is at:

http://cr.openjdk.java.net/~anthony/8-53-startOnFirstThreadCheck-minimal-8005465.0/



There's some cleanup of the initialization procedure of AWT that makes
it easier to follow. The most essential change is that AWT no longer
throws an exception if it's started on the main thread and the
-XstartOnMainThread hasn't been specified when running the app. This is
to allow one to initialize the AWT from the AppKit thread (which is the
FX User Thread on the Mac).

There are still a few issues remain (specifically, 8006320 and 8006326),
but they may require more time to investigate, and we need to back-port
this fix to a 7 update release as soon as possible.

The fix has been tested with FX for the desired use-case, as well as
with SWT (thanks Petr!). No problems found.

--
best regards,
Anthony

Reply via email to