From 33ff1e3a6e64288028d8c2a8beb350a9f7c89720 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 9 Jul 2013 04:25:06 +0200 Subject: RunnableTask/FunctionTask run(): Write tExecuted in finally block, removing code redundancy and placing write at end of operation. --- src/java/com/jogamp/common/util/FunctionTask.java | 7 +++---- src/java/com/jogamp/common/util/RunnableTask.java | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/java/com/jogamp/common/util/FunctionTask.java b/src/java/com/jogamp/common/util/FunctionTask.java index a131838..01f85b1 100644 --- a/src/java/com/jogamp/common/util/FunctionTask.java +++ b/src/java/com/jogamp/common/util/FunctionTask.java @@ -132,9 +132,7 @@ public class FunctionTask extends TaskBase implements Function { 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()); @@ -144,14 +142,14 @@ public class FunctionTask extends TaskBase implements Function { 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()); @@ -162,6 +160,7 @@ public class FunctionTask extends TaskBase implements Function { throw new RuntimeException(runnableException); } } finally { + tExecuted = System.currentTimeMillis(); syncObject.notifyAll(); } } diff --git a/src/java/com/jogamp/common/util/RunnableTask.java b/src/java/com/jogamp/common/util/RunnableTask.java index ce4688d..c18556b 100644 --- a/src/java/com/jogamp/common/util/RunnableTask.java +++ b/src/java/com/jogamp/common/util/RunnableTask.java @@ -93,9 +93,7 @@ public class RunnableTask extends TaskBase { if(null == 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()); @@ -105,14 +103,14 @@ public class RunnableTask extends TaskBase { 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()); @@ -123,6 +121,7 @@ public class RunnableTask extends TaskBase { throw new RuntimeException(runnableException); } } finally { + tExecuted = System.currentTimeMillis(); syncObject.notifyAll(); } } -- cgit v1.2.3