summaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorkbr <[email protected]>2006-12-04 07:51:52 +0000
committerkbr <[email protected]>2006-12-04 07:51:52 +0000
commit3c5f77f4c527f5b5ccc9e3b256ad2c9eca623114 (patch)
treed6414a93d990fbc9bc5327bd795f512042e65411 /src/java
parentc834967ecc6f5e6441e5b9881f2669896982c9c2 (diff)
Added support for using JOAL alongside JOGL in JOGLAppletLauncher. If
JOAL classes are detected, will download, install and load JOAL's native libraries as well as JOGL's. Added NativeLibLoader.disable() method to JOAL to support this. Added code to JOGLAppletLauncher to detect if -Dsun.java2d.noddraw=true was missing from deployment.properties and if so to prompt user about adding it automatically. Fixed bug in new per-native-library timestamp code. Refactored JOAL SingleStaticSource demo to make it easier to embed in an applet. git-svn-id: file:///home/mbien/NetBeansProjects/JOGAMP/joal-sync/git-svn/../svn-server-sync/joal/trunk@371 03bf7f67-59de-4072-a415-9a990d468a3f
Diffstat (limited to 'src/java')
-rwxr-xr-xsrc/java/net/java/games/joal/NativeLibLoader.java51
1 files changed, 33 insertions, 18 deletions
diff --git a/src/java/net/java/games/joal/NativeLibLoader.java b/src/java/net/java/games/joal/NativeLibLoader.java
index 5aace19..f47c96d 100755
--- a/src/java/net/java/games/joal/NativeLibLoader.java
+++ b/src/java/net/java/games/joal/NativeLibLoader.java
@@ -41,28 +41,43 @@ import java.security.*;
import com.sun.gluegen.runtime.*;
class NativeLibLoader {
- static {
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- // Workaround for problem in OpenAL32.dll, which is actually
- // the "wrapper" DLL which looks for real OpenAL
- // implementations like nvopenal.dll and "*oal.dll".
- // joal.dll matches this wildcard and a bug in OpenAL32.dll
- // causes a call through a null function pointer.
- System.loadLibrary("joal_native");
+ private static volatile boolean loadingEnabled = true;
+ private static volatile boolean didLoading;
- // 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.
- // FIXME: need to figure out an appropriate entry point to call
- // JAWT jawt = new JAWT();
- // JAWTFactory.JAWT_GetAWT(jawt);
+ public static void disableLoading() {
+ loadingEnabled = false;
+ }
- return null;
- }
- });
+ public static void enableLoading() {
+ loadingEnabled = true;
}
public static void load() {
+ if (!didLoading && loadingEnabled) {
+ synchronized (NativeLibLoader.class) {
+ if (!didLoading && loadingEnabled) {
+ didLoading = true;
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ // Workaround for problem in OpenAL32.dll, which is actually
+ // the "wrapper" DLL which looks for real OpenAL
+ // implementations like nvopenal.dll and "*oal.dll".
+ // joal.dll matches this wildcard and a bug in OpenAL32.dll
+ // causes a call through a null function pointer.
+ System.loadLibrary("joal_native");
+
+ // 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.
+ // FIXME: need to figure out an appropriate entry point to call
+ // JAWT jawt = new JAWT();
+ // JAWTFactory.JAWT_GetAWT(jawt);
+
+ return null;
+ }
+ });
+ }
+ }
+ }
}
}