I think that triggering java.awt.headless=true is enough. The class instance wrapping will be done automatically in java.awt.Toolkit.getDefaultToolkit().

A reliable way to test it is, I guess, as follows: log out of your GUI session, ssh to the Mac box, and try running a headless app (e.g. a printing jtreg test.)

--
best regards,
Anthony

On 10/22/2013 10:15 PM, David DeHaven wrote:

[removing hotspot-dev and build-dev..]

I can't look at the code at the moment as I'm focused on something else... Does 
the wrapping happen automagically at some point based on java.awt.headless? It 
doesn't look trivial to do this from within the scope of java_props_md.c, it 
seems the best I could do from there is trigger java.awt.headless=true if we're 
not in a headful login session. It would be fairly simple to have it set 
java.awt.headless if the logic is there to do the HeadlessToolkit wrapping, and 
that's something that could be done for all platforms (though only Mac would 
use it for the moment).

Otherwise I can just revert it back to my original version and we can continue 
using HToolkit for now.

With the current code, JTREG fails massively in headless mode (due to most 
calls throwing a HeadlessException) and JPRT performs horribly when running the 
jdk_awt tests due to it not running in an Aqua session. Is there some reliable 
way of testing headless mode?

-DrD-

Hello.
I suppose we should request from sqe team to run the jck tests in the "true" 
headless mode via ssh(w/o headless option and w/o access to Aqua session).

On 22.10.2013 21:54, Anthony Petrov wrote:
We don't have to. IIRC, the choice of HToolkit on Mac was made by chance.

Since we must load the lwawt lib in headless on Mac anyway, we may as well use 
the CToolkit (properly wrapped in the HeadlessToolkit). But there's no need to 
continue to use the HToolkit on Mac.

--
best regards,
Anthony

On 10/22/2013 08:22 PM, Leonid Romanov wrote:
There was a discussion why we use HToolkit instead of HeadlessToolkit:
http://mail.openjdk.java.net/pipermail/awt-dev/2012-July/003114.html

So we might want to continue using it.

Also, please be aware that there is HToolkit check in 
GraphicsToolkit.getHeadlessProperty()

On Oct 22, 2013, at 1:23 PM, Artem Ananiev <artem.anan...@oracle.com> wrote:

Hi, David,

thanks for additional cleanup.

I have only one concern. Before the fix, we checked if there is an active Aqua 
session. When no session was found, we falled back to HToolkit. I think this 
logic should be preserved, but slightly corrected: fall back to HeadlessToolkit 
(with CToolkit wrapped in).

Otherwise the only way to run headless on Mac will be to force it with the 
system property. It works this way on Windows, but on Windows we're sure that 
WToolkit can run even without a UI session. Is it also true on Mac? Did you try 
to launch AWT without -Djava.awt.headless=true from remote console with no 
users logged in?

Thanks,

Artem

On 10/22/2013 7:34 AM, David DeHaven wrote:

Updated webrev for JDK (hotspot change is the same):
http://cr.openjdk.java.net/~ddehaven/8025673/jdk.1/

Changes since last version:
- Moved to jdk8/build/jdk to save someone a merge headache, moved changes to 
CompileNativeLibs.gmk to libs/Awt2dLibraries.gmk
- Removed HToolkit option and toolkit selection code from java_props_macosx.[ch]

-DrD-


I want to do one more iteration of this. Based on feedback it seems I can 
remove a bit more code from java_props_macosx.[ch] and make things a bit 
cleaner.

-DrD-

Thanks guys.

Anthony, can you sponsor this for me?

-DrD-

This fix looks fine to me as well.

--
best regards,
Anthony

On 10/20/2013 11:56 PM, David DeHaven wrote:

CCing: build-dev, macosx-port-dev, hotspot-dev

Request for review of JDK-8025673:
https://bugs.openjdk.java.net/browse/JDK-8025673

Proposed changes:
http://cr.openjdk.java.net/~ddehaven/8025673/

This change disables building libawt_xawt.dylib and libawt_headless.dylib on 
Mac since they are not used and not supported. There are too many challenges 
(and not enough time) in removing all X11 code from the Mac build at this time, 
so we're deferring complete removal for later (will be covered by JDK-8003900).

A small change to hotspot is required as it was looking for libawt_xawt.dylib 
and if not found would set java.awt.headless to true. Since we don't build a 
headless only JRE on Mac I just have that method return false. I'm not sure how 
to handle changes to hotspot, can it be pushed along with the jdk changes? 
Without that change the Mac builds will be broken.

Significant build system changes, build-dev guys are encouraged to comment...

I tried excluding all sun/awt/X11 classes in CompileJavaClasses.gmk but that 
broke JNI header generation on platforms still using X11 and I couldn't use the 
big list of excluded files on Mac as that resulted in Java compilation errors, 
so I just added some logic to exclude everything on Mac and left the list in 
place everywhere else.

The changes to CompileNativeLibraries.gmk will port to 
libs/AwtJava2dLibraries.gmk in jdk8/build, however there is a problem in the 
jdk8/build workspace where the build cannot find symbols in JNI libs so that 
issue needs to be resolved first. I've not had time to investigate that problem.


Question for the AWT team, we still have this in java_props_md.c:
458     PreferredToolkit prefToolkit = getPreferredToolkit();
459     if (prefToolkit == CToolkit) {
460         sprops.awt_toolkit = "sun.lwawt.macosx.LWCToolkit";
461     } else {
462         // TODO: do we still need this?
463         sprops.awt_toolkit = "sun.awt.HToolkit";
464     }

Is that necessary? Since we're now using libawt_lwawt in both headless and 
headful modes I would think we could remove the HToolkit option, but I'm not 
100% certain about that.


I've built and tested on Mac and a Linux VM (Ubuntu 12.04) and both seem to be 
working fine.

JPRT run for Mac is in progress, I will submit one for all other platforms when 
it finishes building.

-DrD-







--
Best regards, Sergey.


Reply via email to