@Override public synchronized void stop(){
  if (running) {
    LOGGER.debug("Shutting down Multithreaded cache listener.");
    running=false;
    shutdownRequestMade=true;
    while (!taskQueue.isEmpty()) {
      try {
        Thread.sleep(100);
      }
 catch (      InterruptedException ex) {
        LOGGER.error("Interrupted while waiting for shutdown to complete",ex);
      }
    }
    try {
      Thread.sleep(THREAD_SHUTDOWN_CHECK_INTERVAL);
    }
 catch (    InterruptedException ex) {
      LOGGER.error("Interrupted while waiting for shutdown to complete",ex);
    }
  }
}

@ Override public synchronized void stop ( ) { if ( running ) { LOGGER . debug ( "Shutting down Multithreaded cache listener." ) ; running = false ; shutdownRequestMade = true ; while ( ! taskQueue . isEmpty ( ) ) { try { Thread . sleep ( 100 ) ; } catch ( InterruptedException ex ) { LOGGER . error ( "Interrupted while waiting for shutdown to complete" , ex ) ; } } try { Thread . sleep ( THREAD_SHUTDOWN_CHECK_INTERVAL ) ; } catch ( InterruptedException ex ) { LOGGER . error ( "Interrupted while waiting for shutdown to complete" , ex ) ; } } }
waits for all tasks to complete then shuts down the thread . should be called when the cache is closed on server shutdown . will have no effect if called a second time .
