/** * Method execute. * * @param runnable Runnable */ private static void execute(Runnable runnable) { long begin = System.nanoTime(); try { runnable.run(); RunnableStatsManager.getInstance() .handleStats(runnable.getClass(), System.nanoTime() - begin); } catch (Exception e) { _log.error("Exception in a Runnable execution:", e); } }
@Override public final void run() { writeLock(); try { _activeTasks.addAll(_queue); _queue.clear(); } finally { writeUnlock(); } for (T task; (task = _activeTasks.pollFirst()) != null; ) { final long begin = System.nanoTime(); try { callTask(task); } catch (RuntimeException e) { _log.warn("", e); } finally { RunnableStatsManager.handleStats( task.getClass(), getCalledMethodName(), System.nanoTime() - begin); } } }