diff options
author | Sven Gothel <[email protected]> | 2011-09-23 14:08:13 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-09-23 14:08:13 +0200 |
commit | 609e649443f900116039cda7a1bc7c9359b0242f (patch) | |
tree | 6bc208a3df2f5c487c0631e5e51b34e07f5f97f4 | |
parent | 0a54e4b8e2923d1c4eb5847a397906fb783a10d3 (diff) |
Add boolean system property 'jogamp.gluegen.UseTempJarCache', defaults to 'true' - allowing to disable usage of TempJarCache.
-rwxr-xr-x | make/scripts/runtest.sh | 3 | ||||
-rw-r--r-- | src/java/com/jogamp/common/os/Platform.java | 22 | ||||
-rw-r--r-- | src/java/jogamp/common/Debug.java | 15 |
3 files changed, 32 insertions, 8 deletions
diff --git a/make/scripts/runtest.sh b/make/scripts/runtest.sh index d8436b6..d1ab23d 100755 --- a/make/scripts/runtest.sh +++ b/make/scripts/runtest.sh @@ -32,10 +32,13 @@ rm -f $LOG #D_ARGS="-Djogamp.debug.JARUtil" #D_ARGS="-Djogamp.debug.TempFileCache" #D_ARGS="-Djogamp.debug.JNILibLoader -Djogamp.debug.TempFileCache -Djogamp.debug.JARUtil" +#D_ARGS="-Djogamp.debug.JNILibLoader -Djogamp.gluegen.UseTempJarCache=false" +D_ARGS="-Djogamp.debug.JNILibLoader" function onetest() { clazz=$1 shift + #libspath=$builddir/obj:$builddir/test/build/natives: libspath=$builddir/test/build/natives: echo LD_LIBRARY_PATH=$libspath:$LD_LIBRARY_PATH java $D_ARGS -Djava.library.path=$libspath -classpath lib/junit.jar:$ANT_JARS:$builddir/gluegen-rt.jar:$builddir/gluegen.jar:$builddir/test/build/classes $clazz LD_LIBRARY_PATH=$libspath:$LD_LIBRARY_PATH java $D_ARGS -Djava.library.path=$libspath -classpath lib/junit.jar:$ANT_JARS:$builddir/gluegen-rt.jar:$builddir/gluegen.jar:$builddir/test/build/classes $clazz diff --git a/src/java/com/jogamp/common/os/Platform.java b/src/java/com/jogamp/common/os/Platform.java index 3d255ba..6c582fb 100644 --- a/src/java/com/jogamp/common/os/Platform.java +++ b/src/java/com/jogamp/common/os/Platform.java @@ -41,6 +41,7 @@ import com.jogamp.common.nio.Buffers; import com.jogamp.common.util.JarUtil; import com.jogamp.common.util.cache.TempJarCache; +import jogamp.common.Debug; import jogamp.common.jvm.JVMUtil; import jogamp.common.os.MachineDescriptionRuntime; @@ -50,6 +51,12 @@ import jogamp.common.os.MachineDescriptionRuntime; */ public class Platform { + /** + * System property: 'jogamp.gluegen.UseTempJarCache', defaults to true + */ + public static final boolean USE_TEMP_JAR_CACHE; + private static final String useTempJarCachePropName = "jogamp.gluegen.UseTempJarCache"; + public static final boolean JAVA_SE; public static final boolean LITTLE_ENDIAN; public static final String OS; @@ -190,6 +197,13 @@ public class Platform { os_and_arch = getOSAndArch(OS_TYPE, CPU_ARCH); + USE_TEMP_JAR_CACHE = + AccessController.doPrivileged(new PrivilegedAction<Boolean>() { + public Boolean run() { + return Boolean.valueOf(Debug.getBooleanProperty(true, useTempJarCachePropName, true, AccessController.getContext())); + } + }).booleanValue(); + loadGlueGenRTImpl(); JVMUtil.initSingleton(); @@ -279,13 +293,13 @@ public class Platform { } private static void loadGlueGenRTImpl() { - final String nativeJarName = "gluegen-rt-natives-"+os_and_arch+".jar"; - final String libBaseName = "gluegen-rt"; - final ClassLoader cl = Platform.class.getClassLoader(); + final String libBaseName = "gluegen-rt"; AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { - if(TempJarCache.initSingleton()) { + if(USE_TEMP_JAR_CACHE && TempJarCache.initSingleton()) { + final String nativeJarName = "gluegen-rt-natives-"+os_and_arch+".jar"; + final ClassLoader cl = Platform.class.getClassLoader(); try { final URL jarUrlRoot = JarUtil.getJarURLDirname( JarUtil.getJarURL(Platform.class.getName(), cl) ); diff --git a/src/java/jogamp/common/Debug.java b/src/java/jogamp/common/Debug.java index e425e9c..cf07255 100644 --- a/src/java/jogamp/common/Debug.java +++ b/src/java/jogamp/common/Debug.java @@ -88,8 +88,15 @@ public class Debug { } public static boolean getBooleanProperty(final String property, final boolean jnlpAlias, final AccessControlContext acc) { - Boolean b = Boolean.valueOf(Debug.getProperty(property, jnlpAlias, acc)); - return b.booleanValue(); + return Boolean.valueOf(Debug.getProperty(property, jnlpAlias, acc)).booleanValue(); + } + + public static boolean getBooleanProperty(boolean defaultValue, final String property, final boolean jnlpAlias, final AccessControlContext acc) { + final String valueS = Debug.getProperty(property, jnlpAlias, acc); + if(null != valueS) { + return Boolean.valueOf(Debug.getProperty(property, jnlpAlias, acc)).booleanValue(); + } + return defaultValue; } static boolean isPropertyDefined(final String property, final boolean jnlpAlias) { @@ -107,8 +114,8 @@ public class Debug { public static String getProperty(final String property, final boolean jnlpAlias, final AccessControlContext acc) { String s=null; if(null!=acc && acc.equals(localACC)) { - s = (String) AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + s = AccessController.doPrivileged(new PrivilegedAction<String>() { + public String run() { String val=null; try { val = System.getProperty(property); |