- }\r
-\r
- /**\r
- * If the Executor queue is empty\r
- * \r
- * @return true is not all threads are busy, false overwise\r
- */\r
- public boolean canAcceptMoreWork() {\r
- // alternative to use: executor.getMaximumPoolSize() <\r
- // executor.getActiveCount()\r
- return INSTANCE.getQueue().isEmpty();\r
- }\r
-\r
- @Override\r
- protected void beforeExecute(Thread t, Runnable r) {\r
- super.beforeExecute(t, r);\r
- // class of r is java.util.concurrent.FutureTask\r
- log.info(String.format("Thread %s: start %s", t, r));\r
- startTime.set(System.nanoTime());\r
- }\r
-\r
- @Override\r
- protected void afterExecute(Runnable r, Throwable t) {\r
- try {\r
- long endTime = System.nanoTime();\r
- long taskTime = endTime - startTime.get();\r
- numTasks.incrementAndGet();\r
- totalTime.addAndGet(taskTime);\r
- log.info(String.format("Throwable %s: end %s, time=%dns", t, r,\r
- taskTime));\r
- } finally {\r
- super.afterExecute(r, t);\r
+\r
+ @Override\r
+ protected void beforeExecute(Thread t, Runnable r) {\r
+ super.beforeExecute(t, r);\r
+ // class of r is java.util.concurrent.FutureTask\r
+ log.info(String.format("Thread %s: start %s", t, r));\r
+ startTime.set(System.nanoTime());\r