public void afterExecute(Runnable r, Throwable t) {
    super.afterExecute(r, t);

    // exceptions wrapped by FutureTask
    if (r instanceof FutureTask) {
      try {
        ((FutureTask) r).get();
      } catch (InterruptedException e) {
        throw new AssertionError(e);
      } catch (ExecutionException e) {
        logger.error("Error in executor futuretask", e);
      }
    }

    // exceptions for non-FutureTask runnables [i.e., added via execute() instead of submit()]
    if (t != null) {
      logger.error("Error in ThreadPoolExecutor", t);
    }
  }
 @Override
 protected void afterExecute(Runnable r, Throwable t) {
   super.afterExecute(r, t);
   logExceptionsAfterExecute(r, t);
 }