aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-12-18 17:06:42 +0100
committerSven Gothel <[email protected]>2011-12-18 17:06:42 +0100
commit8fc2136686abeaeba42e2210ae09b509fde40cb5 (patch)
tree23a457b66a4993196c9b316b4f0e56ebd5614894
parenta6352f398fe22ffb7680cedd77cf93ed6b701c7b (diff)
CgDynamicLibraryBundleInfo: Add TempJarCache usage for atomic native jar (of atomic java JAR)
- GLProfile, NWJNILibLoader, NEWTJNILibLoader: Issue Platform.initSingleton() upfront within priviledge block.
-rw-r--r--src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java18
-rw-r--r--src/jogl/classes/javax/media/opengl/GLProfile.java3
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/NWJNILibLoader.java2
-rw-r--r--src/newt/classes/jogamp/newt/NEWTJNILibLoader.java2
4 files changed, 24 insertions, 1 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java b/src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java
index 9e4d76869..ba159b82c 100644
--- a/src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java
@@ -28,12 +28,30 @@
package com.jogamp.opengl.cg;
+import com.jogamp.common.jvm.JNILibLoaderBase;
import com.jogamp.common.os.DynamicLibraryBundleInfo;
+import com.jogamp.common.os.Platform;
+import com.jogamp.common.util.cache.TempJarCache;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.*;
public class CgDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
private static List<String> glueLibNames;
static {
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ Platform.initSingleton();
+
+ if(TempJarCache.isInitialized()) {
+ // Cg class and natives are available in their single atomic JAR files only
+ JNILibLoaderBase.addNativeJarLibs(CgDynamicLibraryBundleInfo.class, "jogl_cg", null);
+ }
+ return null;
+ }
+ });
+
glueLibNames = new ArrayList<String>();
// glueLibNames.addAll(getGlueLibNamesPreload());
glueLibNames.add("jogl_cg");
diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java
index d52fbcd16..6b39fe765 100644
--- a/src/jogl/classes/javax/media/opengl/GLProfile.java
+++ b/src/jogl/classes/javax/media/opengl/GLProfile.java
@@ -116,12 +116,13 @@ public class GLProfile {
System.err.println("GLProfile.initSingleton(firstUIActionOnProcess: "+firstUIActionOnProcess+") - thread "+Thread.currentThread().getName());
Thread.dumpStack();
}
- Platform.initSingleton();
// run the whole static initialization privileged to speed up,
// since this skips checking further access
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
+ Platform.initSingleton();
+
if(TempJarCache.isInitialized()) {
String[] atomicNativeJarBaseNames = new String[] { "nativewindow", "jogl", null };
if( ReflectionUtil.isClassAvailable("com.jogamp.newt.NewtFactory", GLProfile.class.getClassLoader()) ) {
diff --git a/src/nativewindow/classes/jogamp/nativewindow/NWJNILibLoader.java b/src/nativewindow/classes/jogamp/nativewindow/NWJNILibLoader.java
index 2d899bc11..4cf8f448e 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/NWJNILibLoader.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/NWJNILibLoader.java
@@ -33,6 +33,7 @@ import java.security.AccessController;
import java.security.PrivilegedAction;
import com.jogamp.common.jvm.JNILibLoaderBase;
+import com.jogamp.common.os.Platform;
import com.jogamp.common.util.cache.TempJarCache;
public class NWJNILibLoader extends JNILibLoaderBase {
@@ -40,6 +41,7 @@ public class NWJNILibLoader extends JNILibLoaderBase {
public static void loadNativeWindow(final String ossuffix) {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
+ Platform.initSingleton();
final String libName = "nativewindow_"+ossuffix ;
if(TempJarCache.isInitialized() && null == TempJarCache.findLibrary(libName)) {
addNativeJarLibs(NWJNILibLoader.class, "jogl-all", new String[] { "nativewindow" } );
diff --git a/src/newt/classes/jogamp/newt/NEWTJNILibLoader.java b/src/newt/classes/jogamp/newt/NEWTJNILibLoader.java
index 50b217f24..78707e7cf 100644
--- a/src/newt/classes/jogamp/newt/NEWTJNILibLoader.java
+++ b/src/newt/classes/jogamp/newt/NEWTJNILibLoader.java
@@ -43,6 +43,7 @@ import java.security.AccessController;
import java.security.PrivilegedAction;
import com.jogamp.common.jvm.JNILibLoaderBase;
+import com.jogamp.common.os.Platform;
import com.jogamp.common.util.cache.TempJarCache;
public class NEWTJNILibLoader extends JNILibLoaderBase {
@@ -50,6 +51,7 @@ public class NEWTJNILibLoader extends JNILibLoaderBase {
public static void loadNEWT() {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
+ Platform.initSingleton();
final String libName = "newt";
if(TempJarCache.isInitialized() && null == TempJarCache.findLibrary(libName)) {
addNativeJarLibs(NEWTJNILibLoader.class, "jogl-all", new String[] { "nativewindow", "newt" } );