diff options
Diffstat (limited to 'src/newt/classes/jogamp')
7 files changed, 35 insertions, 28 deletions
diff --git a/src/newt/classes/jogamp/newt/DefaultEDTUtil.java b/src/newt/classes/jogamp/newt/DefaultEDTUtil.java index ef8ea66b6..4f2087637 100644 --- a/src/newt/classes/jogamp/newt/DefaultEDTUtil.java +++ b/src/newt/classes/jogamp/newt/DefaultEDTUtil.java @@ -43,6 +43,7 @@ import javax.media.nativewindow.NativeWindowException; import jogamp.common.util.locks.LockDebugUtil; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.util.RunnableTask; import com.jogamp.common.util.locks.Lock; import com.jogamp.newt.util.EDTUtil; @@ -144,7 +145,7 @@ public class DefaultEDTUtil implements EDTUtil { public final boolean invokeStop(final boolean wait, final Runnable task) { if(DEBUG) { System.err.println(Thread.currentThread()+": Default-EDT.invokeStop wait "+wait); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return invokeImpl(wait, task, true /* stop */, false /* provokeError */); } @@ -152,7 +153,7 @@ public class DefaultEDTUtil implements EDTUtil { public final boolean invokeAndWaitError(final Runnable task) { if(DEBUG) { System.err.println(Thread.currentThread()+": Default-EDT.invokeAndWaitError"); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return invokeImpl(true /* wait */, task, false /* stop */, true /* provokeError */); } @@ -177,7 +178,7 @@ public class DefaultEDTUtil implements EDTUtil { // drop task .. System.err.println(Thread.currentThread()+": Warning: Default-EDT about (1) to stop, won't enqueue new task: "+edt); if(DEBUG) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return false; } @@ -191,7 +192,7 @@ public class DefaultEDTUtil implements EDTUtil { if( edt.tasks.size()>0 ) { System.err.println(Thread.currentThread()+": Warning: Default-EDT about (2) to stop, task executed. Remaining tasks: "+edt.tasks.size()+" - "+edt); if(DEBUG) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } } @@ -204,7 +205,7 @@ public class DefaultEDTUtil implements EDTUtil { System.err.println(Thread.currentThread()+": Warning: Default-EDT is not running, dropping task. NEDT "+edt); } if(DEBUG) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } return false; diff --git a/src/newt/classes/jogamp/newt/DisplayImpl.java b/src/newt/classes/jogamp/newt/DisplayImpl.java index 84ce45238..5f67c95c1 100644 --- a/src/newt/classes/jogamp/newt/DisplayImpl.java +++ b/src/newt/classes/jogamp/newt/DisplayImpl.java @@ -34,6 +34,7 @@ package jogamp.newt; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.nio.Buffers; import com.jogamp.common.util.IOUtil; import com.jogamp.common.util.ReflectionUtil; @@ -398,7 +399,7 @@ public abstract class DisplayImpl extends Display { if( DEBUG ) { if ( !res ) { System.err.println("Warning: invokeStop() failed"); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } } @@ -416,7 +417,7 @@ public abstract class DisplayImpl extends Display { if( !_edtUtil.isRunning() ) { // // volatile dbl-checked-locking OK if( DEBUG ) { System.err.println("Info: EDT start "+Thread.currentThread().getName()+", "+this); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } _edtUtil.start(); } @@ -428,7 +429,7 @@ public abstract class DisplayImpl extends Display { } if( DEBUG ) { System.err.println("Warning: invoke(wait "+wait+", ..) on EDT failed .. invoke on current thread "+Thread.currentThread().getName()); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } task.run(); @@ -685,7 +686,7 @@ public abstract class DisplayImpl extends Display { if(null == event) { // Ooops ? System.err.println("Warning: event of eventTask is NULL"); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); return; } dispatchMessage(event); @@ -739,7 +740,7 @@ public abstract class DisplayImpl extends Display { // oops .. we are already dead if(DEBUG) { System.err.println("Warning: EDT already stopped: wait:="+wait+", "+e); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return; } diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index b62628962..0c4dcd192 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -63,6 +63,7 @@ import javax.media.nativewindow.util.RectangleImmutable; import jogamp.nativewindow.SurfaceScaleUtils; import jogamp.nativewindow.SurfaceUpdatedHelper; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.util.ArrayHashSet; import com.jogamp.common.util.IntBitfield; import com.jogamp.common.util.PropertyAccess; @@ -1992,7 +1993,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer protected final void definePosition(final int x, final int y) { if(DEBUG_IMPLEMENTATION) { System.err.println("definePosition: "+this.x+"/"+this.y+" -> "+x+"/"+y); - // Thread.dumpStack(); + // ExceptionUtils.dumpStackTrace(System.err); } autoPosition = false; this.x = x; this.y = y; @@ -2008,7 +2009,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if(DEBUG_IMPLEMENTATION) { System.err.println("defineSize: win["+this.winWidth+"x"+this.winHeight+" -> "+winWidth+"x"+winHeight+ "], pixel["+this.pixWidth+"x"+this.pixHeight+" -> "+pixWidth+"x"+pixHeight+"]"); - // Thread.dumpStack(); + // ExceptionUtils.dumpStackTrace(System.err); } this.winWidth = winWidth; this.winHeight = winHeight; this.pixWidth = pixWidth; this.pixHeight = pixHeight; @@ -2637,7 +2638,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer final boolean discardTO = QUEUED_EVENT_TO <= System.currentTimeMillis()-e.getWhen(); if(DEBUG_IMPLEMENTATION) { System.err.println("Window.consumeEvent: REPAINT "+Thread.currentThread().getName()+" - queued "+e+", discard-to "+discardTO); - // Thread.dumpStack(); + // ExceptionUtils.dumpStackTrace(System.err); } return discardTO; // discardTO:=true -> consumed } @@ -2653,7 +2654,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer final boolean discardTO = QUEUED_EVENT_TO <= System.currentTimeMillis()-e.getWhen(); if(DEBUG_IMPLEMENTATION) { System.err.println("Window.consumeEvent: RESIZED "+Thread.currentThread().getName()+" - queued "+e+", discard-to "+discardTO); - // Thread.dumpStack(); + // ExceptionUtils.dumpStackTrace(System.err); } return discardTO; // discardTO:=true -> consumed } @@ -3745,7 +3746,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer throw new NativeWindowException(msg); } else if (DEBUG_IMPLEMENTATION) { System.err.println(msg); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return -1; } else if( 0 < remaining ){ @@ -3791,7 +3792,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer throw new NativeWindowException(msg); } else if (DEBUG_IMPLEMENTATION) { System.err.println(msg); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return false; } else { @@ -3851,7 +3852,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } else { System.err.println("Auto position not reached within timeout, has "+getX()+"/"+getY()+", autoPosition "+autoPosition+", remaining "+remaining); } - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } return ok; @@ -3892,7 +3893,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer final WindowClosingMode mode = force ? WindowClosingMode.DISPOSE_ON_CLOSE : defMode; if(DEBUG_IMPLEMENTATION) { System.err.println("Window.windowDestroyNotify(isNativeValid: "+isNativeValid()+", force: "+force+", mode "+defMode+" -> "+mode+") "+getThreadName()+": "+this); - // Thread.dumpStack(); + // ExceptionUtils.dumpStackTrace(System.err); } final boolean destroyed; diff --git a/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java index 786ebb31c..6179626d4 100644 --- a/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java @@ -47,6 +47,7 @@ import javax.media.opengl.GLCapabilitiesChooser; import javax.media.opengl.GLCapabilitiesImmutable; import javax.media.opengl.GLException; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.os.AndroidVersion; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; import com.jogamp.newt.MonitorDevice; @@ -282,7 +283,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { protected final boolean canCreateNativeImpl() { Log.d(MD.TAG, "canCreateNativeImpl.0: surfaceHandle ready "+(0!=surfaceHandle)+" - on thread "+Thread.currentThread().getName()); if(Window.DEBUG_IMPLEMENTATION) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } if( isFullscreen() ) { @@ -386,7 +387,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { "], pixel["+getSurfaceWidth()+"x"+getSurfaceHeight()+"],"+ " - on thread "+Thread.currentThread().getName()); if(Window.DEBUG_IMPLEMENTATION) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } setupInputListener(false); @@ -557,7 +558,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { public final void surfaceChanged(final SurfaceHolder aHolder, final int aFormat, final int aWidth, final int aHeight) { Log.d(MD.TAG, "surfaceChanged: f "+nativeFormat+" -> "+aFormat+", "+aWidth+"x"+aHeight+", current surfaceHandle: 0x"+Long.toHexString(surfaceHandle)+" - on thread "+Thread.currentThread().getName()); if(Window.DEBUG_IMPLEMENTATION) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } if(0!=surfaceHandle && androidFormat != aFormat ) { // re-create @@ -611,7 +612,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { public final void surfaceDestroyed(final SurfaceHolder holder) { Log.d(MD.TAG, "surfaceDestroyed - on thread "+Thread.currentThread().getName()); windowDestroyNotify(true); // actually too late .. however .. - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } @Override diff --git a/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java b/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java index 39e68e48c..090fa1653 100644 --- a/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java +++ b/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java @@ -32,6 +32,7 @@ import java.awt.EventQueue; import javax.media.nativewindow.NativeWindowException; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.util.RunnableTask; import com.jogamp.common.util.awt.AWTEDTExecutor; import com.jogamp.newt.util.EDTUtil; @@ -140,7 +141,7 @@ public class AWTEDTUtil implements EDTUtil { // drop task .. System.err.println(Thread.currentThread()+": Warning: AWT-EDT about (1) to stop, won't enqueue new task: "+nedt); if(DEBUG) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return false; } @@ -161,7 +162,7 @@ public class AWTEDTUtil implements EDTUtil { System.err.println(Thread.currentThread()+": Warning: AWT-EDT is not running, dropping task. NEDT "+nedt); } if(DEBUG) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } return false; diff --git a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java index afa9786e2..4b8e71571 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java @@ -50,6 +50,7 @@ import javax.media.nativewindow.util.Insets; import javax.media.nativewindow.util.InsetsImmutable; import javax.media.nativewindow.util.Point; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.nio.Buffers; import com.jogamp.nativewindow.x11.X11GraphicsDevice; import com.jogamp.nativewindow.x11.X11GraphicsScreen; @@ -424,7 +425,7 @@ public class WindowDriver extends WindowImpl { // Internals only // private static final String getCurrentThreadName() { return Thread.currentThread().getName(); } // Callback for JNI - private static final void dumpStack() { Thread.dumpStack(); } // Callback for JNI + private static final void dumpStack() { ExceptionUtils.dumpStack(System.err); } // Callback for JNI private final <T> T runWithLockedDisplayDevice(final DisplayRunnable<T> action) { return ((DisplayDriver) getScreen().getDisplay()).runWithLockedDisplayDevice(action); diff --git a/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java b/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java index 794e989a6..1b4b43a6e 100644 --- a/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java +++ b/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java @@ -31,6 +31,7 @@ import javax.media.nativewindow.NativeWindowException; import jogamp.newt.Debug; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.util.RunnableTask; import com.jogamp.newt.util.EDTUtil; @@ -170,7 +171,7 @@ public class SWTEDTUtil implements EDTUtil { // drop task .. if(DEBUG) { System.err.println(Thread.currentThread()+": Warning: SWT-EDT about (1) to stop, won't enqueue new task: "+nedt+", isRunning "+nedt.isRunning+", shouldStop "+nedt.shouldStop); - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return false; } @@ -195,7 +196,7 @@ public class SWTEDTUtil implements EDTUtil { System.err.println(Thread.currentThread()+": Warning: SWT-EDT is not running, dropping task. NEDT "+nedt); } if(DEBUG) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } } return false; @@ -212,7 +213,7 @@ public class SWTEDTUtil implements EDTUtil { if( swtDisplay.isDisposed() ) { System.err.println(Thread.currentThread()+": Warning: SWT-EDT is about (3) to stop and stopped already, dropping task. "+nedt); if(DEBUG) { - Thread.dumpStack(); + ExceptionUtils.dumpStack(System.err); } return false; } |