@Override public void execute(Runnable task){
  tasksInProcess.incrementAndGet();
  try {
    super.execute(task);
  }
 catch (  RuntimeException|Error e) {
    tasksInProcess.decrementAndGet();
    throw e;
  }
}

@ Override public void execute ( Runnable task ) { tasksInProcess . incrementAndGet ( ) ; try { super . execute ( task ) ; } catch ( RuntimeException | Error e ) { tasksInProcess . decrementAndGet ( ) ; throw e ; } }
before calling super ' s version of this method , the amount of tasks which are currently in process is first incremented .
