diff options
Diffstat (limited to 'make/jawt-CustomJavaCode.java')
-rwxr-xr-x | make/jawt-CustomJavaCode.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/make/jawt-CustomJavaCode.java b/make/jawt-CustomJavaCode.java new file mode 100755 index 000000000..7e8e83b39 --- /dev/null +++ b/make/jawt-CustomJavaCode.java @@ -0,0 +1,27 @@ +private static volatile JAWT jawt; + +/** Helper routine for all users to call to access the JAWT. */ +public static JAWT getJAWT() { + if (jawt == null) { + synchronized (JAWT.class) { + if (jawt == null) { + NativeLibLoader.loadAWTImpl(); + // Workaround for 4845371. + // Make sure the first reference to the JNI GetDirectBufferAddress is done + // from a privileged context so the VM's internal class lookups will succeed. + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + JAWT j = JAWT.create(); + j.version(JAWTFactory.JAWT_VERSION_1_4); + if (!JAWTFactory.JAWT_GetAWT(j)) { + throw new RuntimeException("Unable to initialize JAWT"); + } + jawt = j; + return null; + } + }); + } + } + } + return jawt; +} |