@Override protected void afterExecute(Runnable r,Throwable t){
  super.afterExecute(r,t);
synchronized (this) {
    tasksInProcess.decrementAndGet();
    if (tasksInProcess.intValue() == 0) {
      synchronizer.signalAll();
    }
  }
}

@ Override protected void afterExecute ( Runnable r , Throwable t ) { super . afterExecute ( r , t ) ; synchronized ( this ) { tasksInProcess . decrementAndGet ( ) ; if ( tasksInProcess . intValue ( ) == 0 ) { synchronizer . signalAll ( ) ; } } }
after calling super ' s implementation of this method , the amount of tasks which are currently in process is decremented . finally , if the amount of tasks currently running is zero the synchronizer ' s signalall ( ) method is invoked , thus anyone awaiting on this instance of threadpoolexecutor is released .
