public void shutdown(){
  if (!shutdownThePool) {
    shutdownThePool=true;
    for (    WorkerThread thread : threads) {
      thread.terminate();
    }
    lock.lock();
    try {
      hasTasks.signalAll();
    }
  finally {
      lock.unlock();
    }
  }
}

public void shutdown ( ) { if ( ! shutdownThePool ) { shutdownThePool = true ; for ( WorkerThread thread : threads ) { thread . terminate ( ) ; } lock . lock ( ) ; try { hasTasks . signalAll ( ) ; } finally { lock . unlock ( ) ; } } }
shuts down the threadpool .
