aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-04-10 02:49:14 +0200
committerSven Gothel <[email protected]>2013-04-10 02:49:14 +0200
commiteff09c3545f32f1f481198d57de71a5bf564e797 (patch)
tree704faeb913d7d396ac10ee3dafa6a4aef7b9f595 /src/jogl
parent2b3bb9426385d97375c3312f5c0f4e2a827b1fbb (diff)
Debug Messages: Unify getThreadName() usage and 'Catched Exception' messages
Diffstat (limited to 'src/jogl')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/Animator.java4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java12
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java10
-rw-r--r--src/jogl/classes/javax/media/opengl/GLContext.java4
-rw-r--r--src/jogl/classes/javax/media/opengl/GLDrawableFactory.java2
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLCanvas.java6
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLJPanel.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/GLDrawableHelper.java12
-rw-r--r--src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/GLWorkerThread.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/SharedResourceRunner.java26
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java2
20 files changed, 64 insertions, 64 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/Animator.java b/src/jogl/classes/com/jogamp/opengl/util/Animator.java
index c5b3b3f44..ac2b24117 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/Animator.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/Animator.java
@@ -145,7 +145,7 @@ public class Animator extends AnimatorBase {
public void run() {
try {
if(DEBUG) {
- System.err.println("Animator start on " + Thread.currentThread().getName() + ": " + toString());
+ System.err.println("Animator start on " + getThreadName() + ": " + toString());
}
fpsCounter.resetFPSCounter();
animThread = Thread.currentThread();
@@ -265,7 +265,7 @@ public class Animator extends AnimatorBase {
runnable = new MainLoop();
}
fpsCounter.resetFPSCounter();
- String threadName = Thread.currentThread().getName()+"-"+baseName;
+ String threadName = getThreadName()+"-"+baseName;
Thread thread;
if(null==threadGroup) {
thread = new Thread(runnable, threadName);
diff --git a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java
index aa0e70132..837fc84bd 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java
@@ -138,7 +138,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
baseName = getBaseName("");
}
if(DEBUG) {
- System.err.println("Animator.initImpl: baseName "+baseName+", implClazz "+impl.getClass().getName()+" - "+toString()+" - "+Thread.currentThread().getName());
+ System.err.println("Animator.initImpl: baseName "+baseName+", implClazz "+impl.getClass().getName()+" - "+toString()+" - "+getThreadName());
}
}
}
@@ -173,7 +173,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
@Override
public synchronized void add(final GLAutoDrawable drawable) {
if(DEBUG) {
- System.err.println("Animator add: 0x"+Integer.toHexString(drawable.hashCode())+" - "+toString()+" - "+Thread.currentThread().getName());
+ System.err.println("Animator add: 0x"+Integer.toHexString(drawable.hashCode())+" - "+toString()+" - "+getThreadName());
}
if( drawables.contains(drawable) ) {
throw new IllegalArgumentException("Drawable already added to animator: "+this+", "+drawable);
@@ -204,7 +204,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
@Override
public synchronized void remove(final GLAutoDrawable drawable) {
if(DEBUG) {
- System.err.println("Animator remove: 0x"+Integer.toHexString(drawable.hashCode())+" - "+toString()+" - "+Thread.currentThread().getName());
+ System.err.println("Animator remove: 0x"+Integer.toHexString(drawable.hashCode())+" - "+toString()+" - "+getThreadName());
}
if( !drawables.contains(drawable) ) {
throw new IllegalArgumentException("Drawable not added to animator: "+this+", "+drawable);
@@ -539,14 +539,14 @@ public abstract class AnimatorBase implements GLAnimatorControl {
}
if(DEBUG || blocking && nok) { // Info only if DEBUG or ( blocking && not-ok ) ; !blocking possible if AWT
if( remaining<=0 && nok ) {
- System.err.println("finishLifecycleAction(" + waitCondition.getClass().getName() + "): ++++++ timeout reached ++++++ " + Thread.currentThread().getName());
+ System.err.println("finishLifecycleAction(" + waitCondition.getClass().getName() + "): ++++++ timeout reached ++++++ " + getThreadName());
}
stateSync.lock(); // avoid too many lock/unlock ops
try {
System.err.println("finishLifecycleAction(" + waitCondition.getClass().getName() + "): OK "+(!nok)+
"- pollPeriod "+pollPeriod+", blocking "+blocking+
", waited " + (blocking ? ( TO_WAIT_FOR_FINISH_LIFECYCLE_ACTION - remaining ) : 0 ) + "/" + TO_WAIT_FOR_FINISH_LIFECYCLE_ACTION +
- " - " + Thread.currentThread().getName());
+ " - " + getThreadName());
System.err.println(" - "+toString());
} finally {
stateSync.unlock();
@@ -571,6 +571,8 @@ public abstract class AnimatorBase implements GLAnimatorControl {
}
}
+ protected static String getThreadName() { return Thread.currentThread().getName(); }
+
public String toString() {
return getClass().getName()+"[started "+isStarted()+", animating "+isAnimating()+", paused "+isPaused()+", drawable "+drawables.size()+
", totals[dt "+getTotalFPSDuration()+", frames "+getTotalFPSFrames()+", fps "+getTotalFPS()+
diff --git a/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java b/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java
index bfcab23fd..7613efec6 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java
@@ -235,7 +235,7 @@ public class FPSAnimator extends AnimatorBase {
if ( null != timer || null != task || isStartedImpl() ) {
return false;
}
- timer = new Timer( Thread.currentThread().getName()+"-"+baseName+"-Timer"+(timerNo++) );
+ timer = new Timer( getThreadName()+"-"+baseName+"-Timer"+(timerNo++) );
task = new MainTask();
if(DEBUG) {
System.err.println("FPSAnimator.start() START: "+task+", "+ Thread.currentThread() + ": " + toString());
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java
index eceeea6db..7d110659a 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java
@@ -172,7 +172,10 @@ public class ShaderUtil {
info.shaderBinaryFormats.add(new Integer(formats[i]));
}
}
- } catch (GLException gle) { System.err.println("Catched Exception: "+gle.getMessage()); gle.printStackTrace(); }
+ } catch (GLException gle) {
+ System.err.println("Catched Exception on thread "+Thread.currentThread().getName());
+ gle.printStackTrace();
+ }
}
}
return info.shaderBinaryFormats;
@@ -199,7 +202,10 @@ public class ShaderUtil {
}
info.shaderCompilerAvailable = new Boolean(v);
queryOK = true;
- } catch (GLException gle) { System.err.println("Catched Exception: "+gle.getMessage()); gle.printStackTrace(); }
+ } catch (GLException gle) {
+ System.err.println("Catched Exception on thread "+Thread.currentThread().getName());
+ gle.printStackTrace();
+ }
if(!queryOK) {
info.shaderCompilerAvailable = new Boolean(true);
}
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java
index 05200324d..be947e5f5 100644
--- a/src/jogl/classes/javax/media/opengl/GLContext.java
+++ b/src/jogl/classes/javax/media/opengl/GLContext.java
@@ -1559,9 +1559,7 @@ public abstract class GLContext {
return needColon;
}
- protected static String getThreadName() {
- return Thread.currentThread().getName();
- }
+ protected static String getThreadName() { return Thread.currentThread().getName(); }
}
diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
index 9d5bd0524..e775afbff 100644
--- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
+++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
@@ -255,6 +255,8 @@ public abstract class GLDrawableFactory {
}
}
+ protected static String getThreadName() { return Thread.currentThread().getName(); }
+
/** Returns true if this factory is complete, i.e. ready to be used. Otherwise return false. */
protected abstract boolean isComplete();
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
index 2fdf18404..c1d5fb1d2 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
@@ -687,7 +687,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
if(DEBUG) {
final NativeSurface ns = getNativeSurface();
final long nsH = null != ns ? ns.getSurfaceHandle() : 0;
- System.err.println("GLCanvas.sizeChanged: ("+Thread.currentThread().getName()+"): "+width+"x"+height+" - surfaceHandle 0x"+Long.toHexString(nsH));
+ System.err.println("GLCanvas.sizeChanged: ("+getThreadName()+"): "+width+"x"+height+" - surfaceHandle 0x"+Long.toHexString(nsH));
// Thread.dumpStack();
}
if( validateGLDrawable() ) {
@@ -1209,9 +1209,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
return config;
}
- protected static String getThreadName() {
- return Thread.currentThread().getName();
- }
+ protected static String getThreadName() { return Thread.currentThread().getName(); }
/**
* A most simple JOGL AWT test entry
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
index f1a2ccc7e..dfb769eb4 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
@@ -832,9 +832,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
return tmp[0];
}
- protected static String getThreadName() {
- return Thread.currentThread().getName();
- }
+ protected static String getThreadName() { return Thread.currentThread().getName(); }
//----------------------------------------------------------------------
// Implementations of the various backends
diff --git a/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java b/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java
index 610f08e21..1a862a3b7 100644
--- a/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java
+++ b/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java
@@ -247,8 +247,6 @@ final class ExtensionAvailabilityCache {
private int glXExtensionCount = 0;
private HashSet<String> availableExtensionCache = new HashSet<String>(50);
- static String getThreadName() {
- return Thread.currentThread().getName();
- }
+ static String getThreadName() { return Thread.currentThread().getName(); }
}
diff --git a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java
index 1eb7c618c..705f8b94e 100644
--- a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java
+++ b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java
@@ -118,7 +118,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
final boolean res = isGLStatePreservationSupported() ? true : false;
if( res ) {
if( DEBUG ) {
- System.err.println("GLAutoDrawableBase.setPreserveGLStateAtDestroy: ("+Thread.currentThread().getName()+"): "+preserveGLELSAtDestroy+" -> "+value+" - surfaceHandle 0x"+Long.toHexString(getNativeSurface().getSurfaceHandle()));
+ System.err.println("GLAutoDrawableBase.setPreserveGLStateAtDestroy: ("+getThreadName()+"): "+preserveGLELSAtDestroy+" -> "+value+" - surfaceHandle 0x"+Long.toHexString(getNativeSurface().getSurfaceHandle()));
}
preserveGLELSAtDestroy = value;
}
@@ -200,7 +200,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
GLDrawableImpl _drawable = drawable;
if( null!=_drawable ) {
if(DEBUG) {
- System.err.println("GLAutoDrawableBase.sizeChanged: ("+Thread.currentThread().getName()+"): "+newWidth+"x"+newHeight+" - surfaceHandle 0x"+Long.toHexString(getNativeSurface().getSurfaceHandle()));
+ System.err.println("GLAutoDrawableBase.sizeChanged: ("+getThreadName()+"): "+newWidth+"x"+newHeight+" - surfaceHandle 0x"+Long.toHexString(getNativeSurface().getSurfaceHandle()));
}
if( ! _drawable.getChosenGLCapabilities().isOnscreen() ) {
final RecursiveLock _lock = getLock();
@@ -678,6 +678,8 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
return null != _drawable ? _drawable.getHandle() : 0;
}
+ protected static String getThreadName() { return Thread.currentThread().getName(); }
+
@Override
public String toString() {
return getClass().getSimpleName()+"[ \n\tHelper: " + helper + ", \n\tDrawable: " + drawable +
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
index 9c1cd478b..177c465da 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
@@ -887,7 +887,7 @@ public class GLDrawableHelper {
final Runnable initAction) {
if(null==context) {
if (DEBUG) {
- Exception e = new GLException(Thread.currentThread().getName()+" Info: GLDrawableHelper " + this + ".invokeGL(): NULL GLContext");
+ Exception e = new GLException(getThreadName()+" Info: GLDrawableHelper " + this + ".invokeGL(): NULL GLContext");
e.printStackTrace();
}
return;
@@ -935,7 +935,7 @@ public class GLDrawableHelper {
res = context.makeCurrent();
if (GLContext.CONTEXT_NOT_CURRENT != res) {
if(GLContext.CONTEXT_CURRENT_NEW == res) {
- throw new GLException(Thread.currentThread().getName()+" GLDrawableHelper " + this + ".invokeGL(): Dispose case (no init action given): Native context was not created (new ctx): "+context);
+ throw new GLException(getThreadName()+" GLDrawableHelper " + this + ".invokeGL(): Dispose case (no init action given): Native context was not created (new ctx): "+context);
}
if( listeners.size() > 0 && null != autoDrawable ) {
disposeAllGLEventListener(autoDrawable, false);
@@ -950,7 +950,7 @@ public class GLDrawableHelper {
}
flushGLRunnables();
} catch (Exception e) {
- System.err.println("Catched: "+e.getMessage());
+ System.err.println("Catched Exception on thread "+getThreadName());
e.printStackTrace();
}
if (lastContext != null) {
@@ -1036,7 +1036,7 @@ public class GLDrawableHelper {
try {
context.release();
} catch (Exception e) {
- System.err.println("Catched: "+e.getMessage());
+ System.err.println("Catched Exception on thread "+getThreadName());
e.printStackTrace();
}
}
@@ -1142,7 +1142,7 @@ public class GLDrawableHelper {
context.release();
ctxReleased = true;
} catch (Exception e) {
- System.err.println("Catched: "+e.getMessage());
+ System.err.println("Catched Exception on thread "+getThreadName());
e.printStackTrace();
}
}
@@ -1160,5 +1160,7 @@ public class GLDrawableHelper {
long td = System.currentTimeMillis() - t0;
System.err.println("td0 "+td+"ms, fps "+(1.0/(td/1000.0))+", td-makeCurrent: "+tdA+"ms, td-render "+tdR+"ms, td-swap "+tdS+"ms, td-release "+tdX+"ms, ctx claimed: "+ctxClaimed+", ctx release: "+ctxReleased+", ctx destroyed "+ctxDestroyed);
}
+
+ protected static String getThreadName() { return Thread.currentThread().getName(); }
}
diff --git a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
index 51ec7dda6..ac10e2728 100644
--- a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
@@ -546,7 +546,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
@Override
public final void setSize(GLContext context, int newWidth, int newHeight) throws NativeWindowException, GLException {
if(DEBUG) {
- System.err.println("GLFBODrawableImpl.ResizeableImpl setSize: ("+Thread.currentThread().getName()+"): "+newWidth+"x"+newHeight+" - surfaceHandle 0x"+Long.toHexString(getNativeSurface().getSurfaceHandle()));
+ System.err.println("GLFBODrawableImpl.ResizeableImpl setSize: ("+getThreadName()+"): "+newWidth+"x"+newHeight+" - surfaceHandle 0x"+Long.toHexString(getNativeSurface().getSurfaceHandle()));
}
int lockRes = lockSurface();
if (NativeSurface.LOCK_SURFACE_NOT_READY >= lockRes) {
diff --git a/src/jogl/classes/jogamp/opengl/GLWorkerThread.java b/src/jogl/classes/jogamp/opengl/GLWorkerThread.java
index f7d59e127..112dfcb64 100644
--- a/src/jogl/classes/jogamp/opengl/GLWorkerThread.java
+++ b/src/jogl/classes/jogamp/opengl/GLWorkerThread.java
@@ -219,9 +219,7 @@ public class GLWorkerThread {
return (Thread.currentThread() == thread);
}
- protected static String getThreadName() {
- return Thread.currentThread().getName();
- }
+ protected static String getThreadName() { return Thread.currentThread().getName(); }
static class WorkerRunnable implements Runnable {
public void run() {
diff --git a/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java b/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java
index 7e050c81e..91187cc26 100644
--- a/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java
+++ b/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java
@@ -116,17 +116,17 @@ public class SharedResourceRunner implements Runnable {
if(null != thread && !thread.isAlive()) {
// thread was killed unrecognized ..
if (DEBUG) {
- System.err.println("SharedResourceRunner.start() - dead-old-thread cleanup - "+Thread.currentThread().getName());
+ System.err.println("SharedResourceRunner.start() - dead-old-thread cleanup - "+getThreadName());
}
releaseSharedResources();
thread = null;
}
if(null == thread) {
if (DEBUG) {
- System.err.println("SharedResourceRunner.start() - start new Thread - "+Thread.currentThread().getName());
+ System.err.println("SharedResourceRunner.start() - start new Thread - "+getThreadName());
}
resetState();
- thread = new Thread(this, Thread.currentThread().getName()+"-SharedResourceRunner");
+ thread = new Thread(this, getThreadName()+"-SharedResourceRunner");
thread.setDaemon(true); // Allow JVM to exit, even if this one is running
thread.start();
}
@@ -136,7 +136,7 @@ public class SharedResourceRunner implements Runnable {
public void stop() {
if(null != thread) {
if (DEBUG) {
- System.err.println("SharedResourceRunner.stop() - "+Thread.currentThread().getName());
+ System.err.println("SharedResourceRunner.stop() - "+getThreadName());
}
synchronized (this) {
shouldRelease = true;
@@ -161,14 +161,14 @@ public class SharedResourceRunner implements Runnable {
if (null == sr && !getDeviceTried(connection)) {
addDeviceTried(connection);
if (DEBUG) {
- System.err.println("SharedResourceRunner.getOrCreateShared() " + connection + ": trying - "+Thread.currentThread().getName());
+ System.err.println("SharedResourceRunner.getOrCreateShared() " + connection + ": trying - "+getThreadName());
}
if ( impl.isDeviceSupported(connection) ) {
doAndWait(connection, null);
sr = impl.mapGet(connection);
}
if (DEBUG) {
- System.err.println("SharedResourceRunner.getOrCreateShared() " + connection + ": "+ ( ( null != sr ) ? "success" : "failed" ) +" - "+Thread.currentThread().getName());
+ System.err.println("SharedResourceRunner.getOrCreateShared() " + connection + ": "+ ( ( null != sr ) ? "success" : "failed" ) +" - "+getThreadName());
}
}
}
@@ -183,11 +183,11 @@ public class SharedResourceRunner implements Runnable {
if (null != sr) {
removeDeviceTried(connection);
if (DEBUG) {
- System.err.println("SharedResourceRunner.releaseShared() " + connection + ": trying - "+Thread.currentThread().getName());
+ System.err.println("SharedResourceRunner.releaseShared() " + connection + ": trying - "+getThreadName());
}
doAndWait(null, connection);
if (DEBUG) {
- System.err.println("SharedResourceRunner.releaseShared() " + connection + ": done - "+Thread.currentThread().getName());
+ System.err.println("SharedResourceRunner.releaseShared() " + connection + ": done - "+getThreadName());
}
}
}
@@ -197,7 +197,7 @@ public class SharedResourceRunner implements Runnable {
private final void doAndWait(String initConnection, String releaseConnection) {
// wait until thread becomes ready to init new device,
// pass the device and release the sync
- final String threadName = Thread.currentThread().getName();
+ final String threadName = getThreadName();
if (DEBUG) {
System.err.println("SharedResourceRunner.doAndWait() START init: " + initConnection + ", release: "+releaseConnection+" - "+threadName);
}
@@ -230,7 +230,7 @@ public class SharedResourceRunner implements Runnable {
}
public final void run() {
- final String threadName = Thread.currentThread().getName();
+ final String threadName = getThreadName();
if (DEBUG) {
System.err.println("SharedResourceRunner.run(): STARTED - " + threadName);
@@ -249,7 +249,7 @@ public class SharedResourceRunner implements Runnable {
} catch (InterruptedException ex) {
shouldRelease = true;
if(DEBUG) {
- System.err.println("SharedResourceRunner.run(): INTERRUPTED - "+Thread.currentThread().getName());
+ System.err.println("SharedResourceRunner.run(): INTERRUPTED - "+threadName);
ex.printStackTrace();
}
}
@@ -319,10 +319,12 @@ public class SharedResourceRunner implements Runnable {
try {
impl.releaseSharedResource(iter.next());
} catch (Throwable t) {
- System.err.println("Catched Exception: "+t.getStackTrace()+" - "+Thread.currentThread().getName());
+ System.err.println("Catched Exception on thread "+getThreadName());
t.printStackTrace();
}
}
impl.clear();
}
+
+ protected static String getThreadName() { return Thread.currentThread().getName(); }
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
index b390621fa..be3729a7d 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
@@ -456,7 +456,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
}
} catch (Throwable t) {
if(DEBUG) {
- System.err.println("Catched Exception:");
+ System.err.println("Catched Exception on thread "+getThreadName());
t.printStackTrace();
}
success = false;
@@ -597,7 +597,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
}
} catch (GLException gle) {
if(DEBUG) {
- System.err.println("Catched Exception while EGL Shared Resource initialization");
+ System.err.println("Catched Exception on thread "+getThreadName());
gle.printStackTrace();
}
}
@@ -658,8 +658,6 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
return new EGLOnscreenDrawable(this, EGLWrappedSurface.get(target));
}
- static String getThreadName() { return Thread.currentThread().getName(); }
-
@Override
protected GLDrawableImpl createOffscreenDrawableImpl(NativeSurface target) {
if (target == null) {
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
index f99d89df7..a197bd51f 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
@@ -669,7 +669,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
setSwapIntervalImpl(nsOpenGLLayer, interval); // enabled per default in layered surface
valid = true;
if (DEBUG) {
- System.err.println("NSOpenGLLayer.Attach: OK, layer "+toHexString(nsOpenGLLayer)+" w/ pbuffer "+toHexString(pbuffer)+", texID "+texID+", texSize "+lastWidth+"x"+lastHeight+", drawableHandle "+toHexString(drawable.getHandle())+" - "+Thread.currentThread().getName());
+ System.err.println("NSOpenGLLayer.Attach: OK, layer "+toHexString(nsOpenGLLayer)+" w/ pbuffer "+toHexString(pbuffer)+", texID "+texID+", texSize "+lastWidth+"x"+lastHeight+", drawableHandle "+toHexString(drawable.getHandle())+" - "+getThreadName());
}
} finally {
MacOSXCGLContext.this.lock.unlock();
@@ -685,7 +685,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
if( !valid ) {
// could not acquire lock, re-queue
if (DEBUG) {
- System.err.println("NSOpenGLLayer.Attach: Re-Queue, drawableHandle "+toHexString(drawable.getHandle())+" - "+Thread.currentThread().getName());
+ System.err.println("NSOpenGLLayer.Attach: Re-Queue, drawableHandle "+toHexString(drawable.getHandle())+" - "+getThreadName());
}
OSXUtil.RunLater(this, 1);
}
@@ -713,17 +713,17 @@ public abstract class MacOSXCGLContext extends GLContextImpl
ols.detachSurfaceLayer();
}
} catch(Throwable t) {
- System.err.println("Catched exception @ "+Thread.currentThread().getName()+": ");
+ System.err.println("Catched Exception on thread "+getThreadName());
t.printStackTrace();
}
CGL.releaseNSOpenGLLayer(cmd.nsOpenGLLayer);
if(DEBUG) {
- System.err.println("NSOpenGLLayer.Detach: OK, layer "+toHexString(cmd.nsOpenGLLayer)+" - "+Thread.currentThread().getName());
+ System.err.println("NSOpenGLLayer.Detach: OK, layer "+toHexString(cmd.nsOpenGLLayer)+" - "+getThreadName());
}
cmd.nsOpenGLLayer = 0;
cmd.valid = false;
} else if(DEBUG) {
- System.err.println("NSOpenGLLayer.Detach: Skipped "+toHexString(cmd.nsOpenGLLayer)+" - "+Thread.currentThread().getName());
+ System.err.println("NSOpenGLLayer.Detach: Skipped "+toHexString(cmd.nsOpenGLLayer)+" - "+getThreadName());
}
}
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java
index 1daa892ba..910158d1f 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java
@@ -152,10 +152,6 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl {
return getFactoryImpl().getGLDynamicLookupHelper(0);
}
- protected static String getThreadName() {
- return Thread.currentThread().getName();
- }
-
// Support for "mode switching" as described in MacOSXCGLDrawable
public void setOpenGLMode(GLBackendType mode) {
if (mode == openGLMode) {
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
index aaca7c78a..6c647108f 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
@@ -291,7 +291,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
}
} catch (GLException gle) {
if(DEBUG) {
- System.err.println("Catched Exception while MaxOSXCGL Shared Resource initialization:");
+ System.err.println("Catched Exception on thread "+getThreadName());
gle.printStackTrace();
}
}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
index aea0d7973..d7d6ceab4 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
@@ -174,7 +174,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
long pid = GDI.GetCurrentProcess();
if ( GDI.GetProcessAffinityMask(pid, procMask, sysMask) ) {
if(DEBUG) {
- System.err.println("WindowsWGLDrawableFactory.enterThreadCriticalZone() - 0x" + Long.toHexString(pid) + " - " + Thread.currentThread().getName());
+ System.err.println("WindowsWGLDrawableFactory.enterThreadCriticalZone() - 0x" + Long.toHexString(pid) + " - " + getThreadName());
// Thread.dumpStack();
}
processAffinityChanges = pid;
@@ -194,7 +194,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
" this PID 0x" + Long.toHexString(pid) );
}
if(DEBUG) {
- System.err.println("WindowsWGLDrawableFactory.leaveThreadCriticalZone() - 0x" + Long.toHexString(pid) + " - " + Thread.currentThread().getName());
+ System.err.println("WindowsWGLDrawableFactory.leaveThreadCriticalZone() - 0x" + Long.toHexString(pid) + " - " + getThreadName());
}
GDI.SetProcessAffinityMask(pid, sysMask.get(0));
}
@@ -432,7 +432,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
}
} catch (GLException gle) {
if(DEBUG) {
- System.err.println("Catched Exception while WindowsWGL Shared Resource initialization");
+ System.err.println("Catched Exception on thread "+getThreadName());
gle.printStackTrace();
}
}
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
index f22bbfc52..2f3940baa 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
@@ -360,7 +360,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
}
} catch (GLException gle) {
if(DEBUG) {
- System.err.println("Catched Exception while X11GLX Shared Resource initialization");
+ System.err.println("Catched Exception on thread "+getThreadName());
gle.printStackTrace();
}
}