diff options
author | Sven Gothel <[email protected]> | 2013-03-18 04:02:46 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-03-18 04:02:46 +0100 |
commit | 192224fc3c38521f38eb3bc51bebb16b628e4cdb (patch) | |
tree | 45eb572fed6672e5eacc9531b48aca226e579c08 /src/java/com/jogamp/common/util/FunctionTask.java | |
parent | b1eb7ca6b9d7dec7ff62c1f1e8ef0a0545724d2f (diff) |
Function- RunnableTask: Clear runnableException @ start for re-entry; Fix tExecuted (@ exception); Add debug property 'jogamp.debug.TaskBase.TraceSource', to dump ctor stack trace @ exception.
Diffstat (limited to 'src/java/com/jogamp/common/util/FunctionTask.java')
-rw-r--r-- | src/java/com/jogamp/common/util/FunctionTask.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/java/com/jogamp/common/util/FunctionTask.java b/src/java/com/jogamp/common/util/FunctionTask.java index 8238aff..a131838 100644 --- a/src/java/com/jogamp/common/util/FunctionTask.java +++ b/src/java/com/jogamp/common/util/FunctionTask.java @@ -127,35 +127,41 @@ public class FunctionTask<R,A> extends TaskBase implements Function<R,A> { final A[] args = this.args; this.args = null; this.result = null; + runnableException = null; tStarted = System.currentTimeMillis(); if(null == syncObject) { try { this.result = runnable.eval(args); + tExecuted = System.currentTimeMillis(); } catch (Throwable t) { + tExecuted = System.currentTimeMillis(); runnableException = t; if(null != exceptionOut) { + exceptionOut.println("FunctionTask.run(): "+getExceptionOutIntro()+" exception occured on thread "+Thread.currentThread().getName()+": "+toString()); + printSourceTrace(); t.printStackTrace(exceptionOut); } if(!catchExceptions) { throw new RuntimeException(runnableException); } - } finally { - tExecuted = System.currentTimeMillis(); } } else { synchronized (syncObject) { try { this.result = runnable.eval(args); + tExecuted = System.currentTimeMillis(); } catch (Throwable t) { + tExecuted = System.currentTimeMillis(); runnableException = t; if(null != exceptionOut) { + exceptionOut.println("FunctionTask.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(); } } |