From 192224fc3c38521f38eb3bc51bebb16b628e4cdb Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 18 Mar 2013 04:02:46 +0100 Subject: Function- RunnableTask: Clear runnableException @ start for re-entry; Fix tExecuted (@ exception); Add debug property 'jogamp.debug.TaskBase.TraceSource', to dump ctor stack trace @ exception. --- src/java/com/jogamp/common/util/RunnableTask.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/java/com/jogamp/common/util/RunnableTask.java') diff --git a/src/java/com/jogamp/common/util/RunnableTask.java b/src/java/com/jogamp/common/util/RunnableTask.java index ee484e1..ce4688d 100644 --- a/src/java/com/jogamp/common/util/RunnableTask.java +++ b/src/java/com/jogamp/common/util/RunnableTask.java @@ -88,35 +88,41 @@ public class RunnableTask extends TaskBase { @Override public final void run() { + runnableException = null; tStarted = System.currentTimeMillis(); if(null == syncObject) { try { runnable.run(); + tExecuted = System.currentTimeMillis(); } catch (Throwable t) { + tExecuted = System.currentTimeMillis(); runnableException = t; if(null != exceptionOut) { - t.printStackTrace(exceptionOut); + exceptionOut.println("RunnableTask.run(): "+getExceptionOutIntro()+" exception occured on thread "+Thread.currentThread().getName()+": "+toString()); + printSourceTrace(); + runnableException.printStackTrace(exceptionOut); } if(!catchExceptions) { throw new RuntimeException(runnableException); } - } finally { - tExecuted = System.currentTimeMillis(); } } else { synchronized (syncObject) { try { runnable.run(); + tExecuted = System.currentTimeMillis(); } catch (Throwable t) { + tExecuted = System.currentTimeMillis(); runnableException = t; if(null != exceptionOut) { + exceptionOut.println("RunnableTask.run(): "+getExceptionOutIntro()+" exception occured on thread "+Thread.currentThread().getName()+": "+toString()); + printSourceTrace(); t.printStackTrace(exceptionOut); } if(!catchExceptions) { throw new RuntimeException(runnableException); } } finally { - tExecuted = System.currentTimeMillis(); syncObject.notifyAll(); } } -- cgit v1.2.3