summaryrefslogtreecommitdiffstats
path: root/src/jogl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-12-01 16:48:45 +0100
committerSven Gothel <[email protected]>2011-12-01 16:48:45 +0100
commit53ba4a2b3639a3746218693ea588159e5c6d07c7 (patch)
tree366dfa15bf1ddc23181d4e00eedf701a260dc092 /src/jogl
parent2c0a0981f7e1376064abd981c79c65c9d1b57410 (diff)
GLDrawableFactory: Implementations lifecycle is handled via constructor/destroy()
Diffstat (limited to 'src/jogl')
-rw-r--r--src/jogl/classes/javax/media/opengl/GLDrawableFactory.java70
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java37
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java77
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java92
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java78
5 files changed, 211 insertions, 143 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
index 3bdbf5460..cc71c53cf 100644
--- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
+++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
@@ -47,6 +47,7 @@ import java.util.List;
import com.jogamp.common.JogampRuntimeException;
import jogamp.common.Debug;
+
import com.jogamp.common.util.ReflectionUtil;
import javax.media.nativewindow.AbstractGraphicsDevice;
@@ -94,7 +95,7 @@ public abstract class GLDrawableFactory {
static final String macosxFactoryClassNameCGL = "jogamp.opengl.macosx.cgl.MacOSXCGLDrawableFactory";
static final String macosxFactoryClassNameAWTCGL = "jogamp.opengl.macosx.cgl.awt.MacOSXAWTCGLDrawableFactory";
- private static volatile boolean initialized = false;
+ private static volatile boolean isInit = false;
private static GLDrawableFactory eglFactory;
private static GLDrawableFactory nativeOSFactory;
@@ -104,17 +105,24 @@ public abstract class GLDrawableFactory {
private static boolean factoryShutdownHookRegistered = false;
private static Thread factoryShutdownHook = null;
- /**
- * Instantiate singleton factories if available, EGLES1, EGLES2 and the OS native ones.
- */
static {
nativeOSType = NativeWindowFactory.getNativeWindowType(true);
}
- protected static final void initialize() {
- if(initialized) { return; }
- initialized = true;
-
+ /**
+ * Instantiate singleton factories if available, EGLES1, EGLES2 and the OS native ones.
+ */
+ public static final void initSingleton() {
+ if (!isInit) { // volatile: ok
+ synchronized (GLDrawableFactory.class) {
+ if (!isInit) {
+ isInit=true;
+ initSingletonImpl();
+ }
+ }
+ }
+ }
+ private static final void initSingletonImpl() {
registerFactoryShutdownHook();
GLDrawableFactory tmp = null;
@@ -165,6 +173,30 @@ public abstract class GLDrawableFactory {
eglFactory = tmp;
}
+ protected static void shutdown() {
+ if (isInit) { // volatile: ok
+ synchronized (GLDrawableFactory.class) {
+ if (isInit) {
+ isInit=false;
+ unregisterFactoryShutdownHook();
+ shutdownImpl();
+ }
+ }
+ }
+ }
+ private static void shutdownImpl() {
+ synchronized(glDrawableFactories) {
+ for(int i=0; i<glDrawableFactories.size(); i++) {
+ glDrawableFactories.get(i).destroy();
+ }
+ glDrawableFactories.clear();
+
+ // both were members of glDrawableFactories and are shutdown already
+ nativeOSFactory = null;
+ eglFactory = null;
+ }
+ }
+
private static synchronized void registerFactoryShutdownHook() {
if (factoryShutdownHookRegistered) {
return;
@@ -174,7 +206,7 @@ public abstract class GLDrawableFactory {
GLDrawableFactory.shutdownImpl();
}
});
- AccessController.doPrivileged(new PrivilegedAction() {
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
Runtime.getRuntime().addShutdownHook(factoryShutdownHook);
return null;
@@ -187,7 +219,7 @@ public abstract class GLDrawableFactory {
if (!factoryShutdownHookRegistered) {
return;
}
- AccessController.doPrivileged(new PrivilegedAction() {
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
Runtime.getRuntime().removeShutdownHook(factoryShutdownHook);
return null;
@@ -196,22 +228,6 @@ public abstract class GLDrawableFactory {
factoryShutdownHookRegistered = false;
}
- private static void shutdownImpl() {
- synchronized(glDrawableFactories) {
- for(int i=0; i<glDrawableFactories.size(); i++) {
- glDrawableFactories.get(i).shutdownInstance();
- }
- glDrawableFactories.clear();
- }
- }
-
- protected static void shutdown() {
- unregisterFactoryShutdownHook();
- shutdownImpl();
- eglFactory = null;
- nativeOSFactory = null;
- initialized = false;
- }
protected GLDrawableFactory() {
synchronized(glDrawableFactories) {
@@ -222,7 +238,7 @@ public abstract class GLDrawableFactory {
protected void enterThreadCriticalZone() {};
protected void leaveThreadCriticalZone() {};
- protected abstract void shutdownInstance();
+ protected abstract void destroy();
/**
* Retrieve the default <code>device</code> {@link AbstractGraphicsDevice#getConnection() connection},
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
index 4a1a4ccf5..fe4adb564 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
@@ -50,10 +50,9 @@ import java.util.HashMap;
import java.util.List;
public class EGLDrawableFactory extends GLDrawableFactoryImpl {
- private static final GLDynamicLookupHelper eglES1DynamicLookupHelper;
- private static final GLDynamicLookupHelper eglES2DynamicLookupHelper;
-
- static {
+ public EGLDrawableFactory() {
+ super();
+
// Register our GraphicsConfigurationFactory implementations
// The act of constructing them causes them to be registered
EGLGraphicsConfigurationFactory.registerFactory();
@@ -94,13 +93,33 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
if(null!=eglES2DynamicLookupHelper && eglES2DynamicLookupHelper.isLibComplete()) {
EGL.resetProcAddressTable(eglES2DynamicLookupHelper);
}
+ if(null != eglES1DynamicLookupHelper || null != eglES2DynamicLookupHelper) {
+ defaultDevice = new EGLGraphicsDevice(AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT);
+ sharedMap = new HashMap();
+ }
}
- public EGLDrawableFactory() {
- super();
- defaultDevice = new EGLGraphicsDevice(AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT);
+ protected final void destroy() {
+ if(null != sharedMap) {
+ sharedMap.clear();
+ sharedMap = null;
+ }
+ defaultDevice = null;
+ if(null != eglES1DynamicLookupHelper) {
+ eglES1DynamicLookupHelper.destroy();
+ eglES1DynamicLookupHelper = null;
+ }
+ if(null != eglES2DynamicLookupHelper) {
+ eglES2DynamicLookupHelper.destroy();
+ eglES2DynamicLookupHelper = null;
+ }
}
+ private GLDynamicLookupHelper eglES1DynamicLookupHelper;
+ private GLDynamicLookupHelper eglES2DynamicLookupHelper;
+ private HashMap/*<connection, SharedResource>*/ sharedMap;
+ private EGLGraphicsDevice defaultDevice;
+
static class SharedResource {
private EGLGraphicsDevice device;
// private EGLDrawable drawable;
@@ -125,8 +144,6 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
final boolean wasES1ContextAvailable() { return wasES1ContextCreated; }
final boolean wasES2ContextAvailable() { return wasES2ContextCreated; }
}
- HashMap/*<connection, SharedResource>*/ sharedMap = new HashMap();
- EGLGraphicsDevice defaultDevice;
public final AbstractGraphicsDevice getDefaultDevice() {
return defaultDevice;
@@ -243,8 +260,6 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
}
}
- protected final void shutdownInstance() {}
-
protected List<GLCapabilitiesImmutable> getAvailableCapabilitiesImpl(AbstractGraphicsDevice device) {
return EGLGraphicsConfigurationFactory.getAvailableCapabilities(this, device);
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
index ed7959ae8..4543424a6 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
@@ -72,43 +72,58 @@ import com.jogamp.common.JogampRuntimeException;
import com.jogamp.common.util.ReflectionUtil;
public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
- private static final DesktopGLDynamicLookupHelper macOSXCGLDynamicLookupHelper;
-
- static {
- DesktopGLDynamicLookupHelper tmp = null;
- try {
- tmp = new DesktopGLDynamicLookupHelper(new MacOSXCGLDynamicLibraryBundleInfo());
- } catch (GLException gle) {
- if(DEBUG) {
- gle.printStackTrace();
- }
+ public MacOSXCGLDrawableFactory() {
+ super();
+
+ DesktopGLDynamicLookupHelper tmp = null;
+ try {
+ tmp = new DesktopGLDynamicLookupHelper(new MacOSXCGLDynamicLibraryBundleInfo());
+ } catch (GLException gle) {
+ if(DEBUG) {
+ gle.printStackTrace();
}
- macOSXCGLDynamicLookupHelper = tmp;
+ }
+ macOSXCGLDynamicLookupHelper = tmp;
+
+ if(null!=macOSXCGLDynamicLookupHelper) {
/** FIXME ??
- if(null!=macOSXCGLDynamicLookupHelper) {
- CGL.getCGLProcAddressTable().reset(macOSXCGLDynamicLookupHelper);
- } */
+ CGL.getCGLProcAddressTable().reset(macOSXCGLDynamicLookupHelper);
+ */
+
+ // Register our GraphicsConfigurationFactory implementations
+ // The act of constructing them causes them to be registered
+ MacOSXCGLGraphicsConfigurationFactory.registerFactory();
+ if(GLProfile.isAWTAvailable()) {
+ try {
+ ReflectionUtil.callStaticMethod("jogamp.opengl.macosx.cgl.awt.MacOSXAWTCGLGraphicsConfigurationFactory",
+ "registerFactory", null, null, getClass().getClassLoader());
+ } catch (JogampRuntimeException jre) { /* n/a .. */ }
+ }
+
+ defaultDevice = new MacOSXGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT);
+ sharedMap = new HashMap<String, SharedResource>();
+ }
+ }
+
+ protected final void destroy() {
+ if(null != sharedMap) {
+ sharedMap.clear();
+ sharedMap = null;
+ }
+ defaultDevice = null;
+ if(null != macOSXCGLDynamicLookupHelper) {
+ macOSXCGLDynamicLookupHelper.destroy();
+ macOSXCGLDynamicLookupHelper = null;
+ }
}
public GLDynamicLookupHelper getGLDynamicLookupHelper(int profile) {
return macOSXCGLDynamicLookupHelper;
}
- public MacOSXCGLDrawableFactory() {
- super();
-
- // Register our GraphicsConfigurationFactory implementations
- // The act of constructing them causes them to be registered
- MacOSXCGLGraphicsConfigurationFactory.registerFactory();
- if(GLProfile.isAWTAvailable()) {
- try {
- ReflectionUtil.callStaticMethod("jogamp.opengl.macosx.cgl.awt.MacOSXAWTCGLGraphicsConfigurationFactory",
- "registerFactory", null, null, getClass().getClassLoader());
- } catch (JogampRuntimeException jre) { /* n/a .. */ }
- }
-
- defaultDevice = new MacOSXGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT);
- }
+ private DesktopGLDynamicLookupHelper macOSXCGLDynamicLookupHelper;
+ private HashMap<String, SharedResource> sharedMap = new HashMap<String, SharedResource>();
+ private MacOSXGraphicsDevice defaultDevice;
static class SharedResource {
// private MacOSXCGLDrawable drawable;
@@ -136,8 +151,6 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
final boolean isRECTTextureAvailable() { return hasRECTTextures; }
final boolean isAppletFloatPixelsAvailable() { return hasAppletFloatPixels; }
}
- HashMap<String, SharedResource> sharedMap = new HashMap<String, SharedResource>();
- MacOSXGraphicsDevice defaultDevice;
public final AbstractGraphicsDevice getDefaultDevice() {
return defaultDevice;
@@ -259,8 +272,6 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
return null;
}
- protected final void shutdownInstance() {}
-
protected List<GLCapabilitiesImmutable> getAvailableCapabilitiesImpl(AbstractGraphicsDevice device) {
return MacOSXCGLGraphicsConfiguration.getAvailableCapabilities(this, device);
}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
index 1b2b0fa4f..8e9bf553b 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
@@ -80,9 +80,9 @@ import jogamp.opengl.GLDynamicLookupHelper;
import jogamp.opengl.SharedResourceRunner;
public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
- private static final DesktopGLDynamicLookupHelper windowsWGLDynamicLookupHelper;
+ public WindowsWGLDrawableFactory() {
+ super();
- static {
DesktopGLDynamicLookupHelper tmp = null;
try {
tmp = new DesktopGLDynamicLookupHelper(new WindowsWGLDynamicLibraryBundleInfo());
@@ -92,48 +92,67 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
}
}
windowsWGLDynamicLookupHelper = tmp;
+
if(null!=windowsWGLDynamicLookupHelper) {
WGL.getWGLProcAddressTable().reset(windowsWGLDynamicLookupHelper);
+
+ // Register our GraphicsConfigurationFactory implementations
+ // The act of constructing them causes them to be registered
+ WindowsWGLGraphicsConfigurationFactory.registerFactory();
+ if(GLProfile.isAWTAvailable()) {
+ try {
+ ReflectionUtil.callStaticMethod("jogamp.opengl.windows.wgl.awt.WindowsAWTWGLGraphicsConfigurationFactory",
+ "registerFactory", null, null, getClass().getClassLoader());
+ } catch (JogampRuntimeException jre) { /* n/a .. */ }
+ }
+
+ defaultDevice = new WindowsGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT);
+ sharedMap = new HashMap<String, SharedResourceRunner.Resource>();
+
+ // Init shared resources off thread
+ // Will be released via ShutdownHook
+ sharedResourceImpl = new SharedResourceImplementation();
+ sharedResourceRunner = new SharedResourceRunner(sharedResourceImpl);
+ sharedResourceThread = new Thread(sharedResourceRunner, Thread.currentThread().getName()+"-SharedResourceRunner");
+ sharedResourceThread.setDaemon(true); // Allow JVM to exit, even if this one is running
+ sharedResourceThread.start();
}
}
- public GLDynamicLookupHelper getGLDynamicLookupHelper(int profile) {
- return windowsWGLDynamicLookupHelper;
- }
-
- public WindowsWGLDrawableFactory() {
- super();
-
- // Register our GraphicsConfigurationFactory implementations
- // The act of constructing them causes them to be registered
- WindowsWGLGraphicsConfigurationFactory.registerFactory();
- if(GLProfile.isAWTAvailable()) {
- try {
- ReflectionUtil.callStaticMethod("jogamp.opengl.windows.wgl.awt.WindowsAWTWGLGraphicsConfigurationFactory",
- "registerFactory", null, null, getClass().getClassLoader());
- } catch (JogampRuntimeException jre) { /* n/a .. */ }
+ protected final void destroy() {
+ if(null != sharedResourceRunner) {
+ sharedResourceRunner.releaseAndWait();
+ sharedResourceRunner = null;
}
+ if(null != sharedMap) {
+ sharedMap.clear();
+ sharedMap = null;
+ }
+ defaultDevice = null;
+ if(null != windowsWGLDynamicLookupHelper) {
+ // FIXME: If closing the native library NativeLibrary.close(),
+ // reload of Applets doesn't work. Dunno why.
+ // windowsWGLDynamicLookupHelper.destroy();
+ windowsWGLDynamicLookupHelper = null;
+ }
+
+ RegisteredClassFactory.shutdownSharedClasses();
+ }
- defaultDevice = new WindowsGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT);
-
- // Init shared resources off thread
- // Will be released via ShutdownHook
- sharedResourceImpl = new SharedResourceImplementation();
- sharedResourceRunner = new SharedResourceRunner(sharedResourceImpl);
- sharedResourceThread = new Thread(sharedResourceRunner, Thread.currentThread().getName()+"-SharedResourceRunner");
- sharedResourceThread.setDaemon(true); // Allow JVM to exit, even if this one is running
- sharedResourceThread.start();
+ public GLDynamicLookupHelper getGLDynamicLookupHelper(int profile) {
+ return windowsWGLDynamicLookupHelper;
}
- WindowsGraphicsDevice defaultDevice;
- SharedResourceImplementation sharedResourceImpl;
- SharedResourceRunner sharedResourceRunner;
- Thread sharedResourceThread;
- HashMap<String /*connection*/, SharedResourceRunner.Resource> sharedMap = new HashMap<String, SharedResourceRunner.Resource>();
+ private DesktopGLDynamicLookupHelper windowsWGLDynamicLookupHelper;
+ private WindowsGraphicsDevice defaultDevice;
+ private SharedResourceImplementation sharedResourceImpl;
+ private SharedResourceRunner sharedResourceRunner;
+ private Thread sharedResourceThread;
+ private HashMap<String /*connection*/, SharedResourceRunner.Resource> sharedMap;
- long processAffinityChanges = 0;
- PointerBuffer procMask = PointerBuffer.allocateDirect(1);
- PointerBuffer sysMask = PointerBuffer.allocateDirect(1);
+ private long processAffinityChanges = 0;
+ private PointerBuffer procMask = PointerBuffer.allocateDirect(1);
+ private PointerBuffer sysMask = PointerBuffer.allocateDirect(1);
protected void enterThreadCriticalZone() {
synchronized (sysMask) {
@@ -413,11 +432,6 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
return (SharedResource) sharedResourceRunner.getOrCreateShared(device);
}
- protected final void shutdownInstance() {
- sharedResourceRunner.releaseAndWait();
- RegisteredClassFactory.shutdownSharedClasses();
- }
-
protected List<GLCapabilitiesImmutable> getAvailableCapabilitiesImpl(AbstractGraphicsDevice device) {
return WindowsWGLGraphicsConfigurationFactory.getAvailableCapabilities(this, device);
}
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
index a68b039ce..d2b9242be 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
@@ -72,15 +72,15 @@ import com.jogamp.common.util.VersionNumber;
public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
- private static final DesktopGLDynamicLookupHelper x11GLXDynamicLookupHelper;
-
public static final VersionNumber versionOneZero = new VersionNumber(1, 0, 0);
public static final VersionNumber versionOneOne = new VersionNumber(1, 1, 0);
public static final VersionNumber versionOneTwo = new VersionNumber(1, 2, 0);
public static final VersionNumber versionOneThree = new VersionNumber(1, 3, 0);
public static final VersionNumber versionOneFour = new VersionNumber(1, 4, 0);
- static {
+ public X11GLXDrawableFactory() {
+ super();
+
DesktopGLDynamicLookupHelper tmp = null;
try {
tmp = new DesktopGLDynamicLookupHelper(new X11GLXDynamicLibraryBundleInfo());
@@ -90,37 +90,57 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
}
}
x11GLXDynamicLookupHelper = tmp;
+
if(null!=x11GLXDynamicLookupHelper) {
GLX.getGLXProcAddressTable().reset(x11GLXDynamicLookupHelper);
+
+ // Register our GraphicsConfigurationFactory implementations
+ // The act of constructing them causes them to be registered
+ X11GLXGraphicsConfigurationFactory.registerFactory();
+
+ defaultDevice = new X11GraphicsDevice(X11Util.getNullDisplayName(), AbstractGraphicsDevice.DEFAULT_UNIT);
+ sharedMap = new HashMap<String, SharedResourceRunner.Resource>();
+
+ // Init shared resources off thread
+ // Will be released via ShutdownHook
+ sharedResourceImpl = new SharedResourceImplementation();
+ sharedResourceRunner = new SharedResourceRunner(sharedResourceImpl);
+ sharedResourceThread = new Thread(sharedResourceRunner, Thread.currentThread().getName()+"-SharedResourceRunner");
+ sharedResourceThread.setDaemon(true); // Allow JVM to exit, even if this one is running
+ sharedResourceThread.start();
+ }
+ }
+
+ protected final void destroy() {
+ if(null != sharedResourceRunner) {
+ sharedResourceRunner.releaseAndWait();
+ sharedResourceRunner = null;
+ }
+ if(null != sharedMap) {
+ sharedMap.clear();
+ sharedMap = null;
}
+ defaultDevice = null;
+ if(null != x11GLXDynamicLookupHelper) {
+ x11GLXDynamicLookupHelper.destroy();
+ x11GLXDynamicLookupHelper = null;
+ }
+
+ // Don't really close pending Display connections,
+ // since this may trigger a JVM exception
+ X11Util.shutdown( false, DEBUG );
}
public GLDynamicLookupHelper getGLDynamicLookupHelper(int profile) {
return x11GLXDynamicLookupHelper;
}
- public X11GLXDrawableFactory() {
- super();
- // Register our GraphicsConfigurationFactory implementations
- // The act of constructing them causes them to be registered
- X11GLXGraphicsConfigurationFactory.registerFactory();
-
- defaultDevice = new X11GraphicsDevice(X11Util.getNullDisplayName(), AbstractGraphicsDevice.DEFAULT_UNIT);
-
- // Init shared resources off thread
- // Will be released via ShutdownHook
- sharedResourceImpl = new SharedResourceImplementation();
- sharedResourceRunner = new SharedResourceRunner(sharedResourceImpl);
- sharedResourceThread = new Thread(sharedResourceRunner, Thread.currentThread().getName()+"-SharedResourceRunner");
- sharedResourceThread.setDaemon(true); // Allow JVM to exit, even if this one is running
- sharedResourceThread.start();
- }
-
- X11GraphicsDevice defaultDevice;
- SharedResourceImplementation sharedResourceImpl;
- SharedResourceRunner sharedResourceRunner;
- Thread sharedResourceThread;
- HashMap<String /* connection */, SharedResourceRunner.Resource> sharedMap = new HashMap<String, SharedResourceRunner.Resource>();
+ private DesktopGLDynamicLookupHelper x11GLXDynamicLookupHelper;
+ private X11GraphicsDevice defaultDevice;
+ private SharedResourceImplementation sharedResourceImpl;
+ private SharedResourceRunner sharedResourceRunner;
+ private Thread sharedResourceThread;
+ private HashMap<String /* connection */, SharedResourceRunner.Resource> sharedMap;
static class SharedResource implements SharedResourceRunner.Resource {
X11GraphicsDevice device;
@@ -332,14 +352,6 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
return (SharedResource) sharedResourceRunner.getOrCreateShared(device);
}
- protected final void shutdownInstance() {
- sharedResourceRunner.releaseAndWait();
-
- // Don't really close pending Display connections,
- // since this may trigger a JVM exception
- X11Util.shutdown( false, DEBUG );
- }
-
protected List<GLCapabilitiesImmutable> getAvailableCapabilitiesImpl(AbstractGraphicsDevice device) {
return X11GLXGraphicsConfigurationFactory.getAvailableCapabilities(this, device);
}