code: public void shutdown(boolean join) {
          ThreadPoolExecutor pool = executor;
          executor = null;
          pool.shutdown(); // Disable new tasks from being submitted
          if (join) {
              try {
                  // Wait a while for existing tasks to terminate
                  if (!pool.awaitTermination(WAIT_FOR_JOBS_SHUTDOWN_TIMEOUT, TimeUnit.SECONDS)) {
                      pool.shutdownNow(); // Cancel currently executing tasks
                      // Wait a while for tasks to respond to being cancelled
                      if (!pool.awaitTermination(WAIT_FOR_JOBS_SHUTDOWN_TIMEOUT, TimeUnit.SECONDS)) {
                          logger.error("Pool did not terminate");
                      }
                  }
              } catch (InterruptedException ie) {
                  // (Re-)Cancel if current thread also interrupted
                  pool.shutdownNow();
                  // Preserve interrupt status
                  Thread.currentThread().interrupt();
              }
          }
      }
docs: Closes the handler.
  
  @param join if the method should wait for the thread to finish before returning.