856 |
|
/** |
857 |
|
* Runs a single task between before/after methods. |
858 |
|
*/ |
859 |
< |
private void runTask(Runnable task) { |
859 |
> |
private void runTask(Runnable task) throws Throwable { |
860 |
|
final ReentrantLock runLock = this.runLock; |
861 |
|
runLock.lock(); |
862 |
+ |
Throwable ex = null; |
863 |
|
try { |
864 |
|
/* |
865 |
|
* Ensure that unless pool is stopping, this thread |
874 |
|
thread.interrupt(); |
875 |
|
|
876 |
|
beforeExecute(thread, task); |
876 |
– |
Throwable ex = null; |
877 |
|
try { |
878 |
|
task.run(); |
879 |
|
} catch (Throwable throwable) { |
880 |
|
ex = throwable; |
881 |
|
} finally { |
882 |
– |
++completedTasks; |
882 |
|
afterExecute(task, ex); |
883 |
|
} |
884 |
|
} finally { |
885 |
+ |
++completedTasks; |
886 |
|
runLock.unlock(); |
887 |
+ |
if (ex != null) |
888 |
+ |
throw ex; |
889 |
|
} |
890 |
|
} |
891 |
|
|
900 |
|
runTask(task); |
901 |
|
task = null; |
902 |
|
} |
903 |
+ |
} catch (Throwable fallThrough) { |
904 |
|
} finally { |
905 |
|
workerDone(this); |
906 |
|
} |