From 3ab518e90eb4cf82bcb8b990d337a5e4a531136b Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 18 Aug 2012 11:46:01 +0200 Subject: GLProfile/NativeWindowFactory: Remove deprecated argument 'firstUIActionOnProcess' of initSingleton() method The notion of changing the threading behavior of native initialization was deprecated for over a year. The code still contained the bits and pieces, i.e. whether X11Util.initSingletion() is invoked before or after optional AWT initialization. This condition has been removed now and behavior is uniform, i.e. X11Util.initSingletion() is invoked after optional AWT initialization. - Removed GLProfile.initSingleton(boolean firstUIActionOnProcess), use remaining GLProfile.initSingleton() - Removed NativeWindowFactory.isFirstUIActionOnProcess() - Changed NativeWindowFactory.initSingleton(boolean firstUIActionOnProcess) to NativeWindowFactory.initSingleton() --- src/jogl/classes/javax/media/opengl/GLProfile.java | 54 +++++++++------------- 1 file changed, 21 insertions(+), 33 deletions(-) (limited to 'src/jogl') diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java index 1e10dc9a6..513ccd101 100644 --- a/src/jogl/classes/javax/media/opengl/GLProfile.java +++ b/src/jogl/classes/javax/media/opengl/GLProfile.java @@ -101,29 +101,29 @@ public class GLProfile { /** * Static initialization of JOGL. + * *

- * The parameter firstUIActionOnProcess has an impact on concurrent locking,
- * see {@link javax.media.nativewindow.NativeWindowFactory#initSingleton(boolean) NativeWindowFactory.initSingleton(firstUIActionOnProcess)}. + * This method shall not need to be called for other reasons than having a defined initialization sequence. *

- *

- * Applications using this method may place it's call before any other UI invocation - * in the main class's static block or within the main function. - * In such case, applications may pass firstUIActionOnProcess=true to use native toolkit locking.

- *

- * RCP Application (Applet's, Webstart, Netbeans, ..) using JOGL are not be able to initialize JOGL - * before the first UI action. - * In such case you shall pass firstUIActionOnProcess=false.

+ * *

* In case this method is not invoked, GLProfile is initialized implicit by - * the first call to {@link #getDefault()}, {@link #get(java.lang.String)} passing firstUIActionOnProcess=false. + * the first call to {@link #getDefault()}, {@link #get(java.lang.String)}. *

- * - * @param firstUIActionOnProcess Should be true if called before the first UI action of the running program, - * otherwise false. * - * @deprecated Use {@link #initSingleton()}. This method is subject to be removed in future versions of JOGL. + *

+ * To initialize JOGL at startup ASAP, this method may be invoked in the main class's + * static initializer block, in the static main() method or in the Applet init() method. + *

+ * + *

+ * Since JOGL's initialization is complex and involves multi threading, it is not recommended + * to be have it invoked on the AWT EDT thread. In case all JOGL usage is performed + * on the AWT EDT, invoke this method outside the AWT EDT - see above. + *

+ * */ - public static void initSingleton(final boolean firstUIActionOnProcess) { + public static void initSingleton() { final boolean justInitialized; initLock.lock(); try { @@ -131,7 +131,7 @@ public class GLProfile { initialized = true; justInitialized = true; if(DEBUG) { - System.err.println("GLProfile.initSingleton(firstUIActionOnProcess: "+firstUIActionOnProcess+") - thread "+Thread.currentThread().getName()); + System.err.println("GLProfile.initSingleton() - thread "+Thread.currentThread().getName()); Thread.dumpStack(); } @@ -171,7 +171,7 @@ public class GLProfile { } JNILibLoaderBase.addNativeJarLibs(classesFromJavaJars, "-all", new String[] { "-noawt", "-mobile", "-core" } ); } - initProfilesForDefaultDevices(firstUIActionOnProcess); + initProfilesForDefaultDevices(); return null; } }); @@ -188,17 +188,6 @@ public class GLProfile { } } - /** - * Static initialization of JOGL. - * - *

- * This method shall not need to be called for other reasons than having a defined initialization sequence. - *

- */ - public static void initSingleton() { - GLProfile.initSingleton(false); - } - /** * Trigger eager initialization of GLProfiles for the given device, * in case it isn't done yet. @@ -1411,11 +1400,10 @@ public class GLProfile { /** * Tries the profiles implementation and native libraries. */ - private static void initProfilesForDefaultDevices(boolean firstUIActionOnProcess) { - NativeWindowFactory.initSingleton(firstUIActionOnProcess); + private static void initProfilesForDefaultDevices() { + NativeWindowFactory.initSingleton(); if(DEBUG) { - System.err.println("GLProfile.init firstUIActionOnProcess: "+ firstUIActionOnProcess - + ", thread: " + Thread.currentThread().getName()); + System.err.println("GLProfile.init - thread: " + Thread.currentThread().getName()); System.err.println(VersionUtil.getPlatformInfo()); System.err.println(GlueGenVersion.getInstance()); System.err.println(NativeWindowVersion.getInstance()); -- cgit v1.2.3