Code example for RejectedExecutionException

0
     */ 
    private void startTask() { 
      lock.lock();
      try { 
        if (isShutdown()) { 
          throw new RejectedExecutionException("Executor already shutdown");
        } 
        runningTasks++;
      } finally { 
        lock.unlock();
      } 
    } 
 
    /** 
     * Decrements the running task count. 
     */ 
    private void endTask() { 
      lock.lock();
      try { 
        runningTasks--;
        if (isTerminated()) {