@Override public void stop(){
  CountDownLatch latch=stopped;
  Thread oldThread=thread.getAndUpdate(null);
  if (oldThread != null && latch != null) {
    try {
      latch.await(10,TimeUnit.SECONDS);
    }
 catch (    InterruptedException e) {
      Thread.interrupted();
    }
  }
}

@ Override public void stop ( ) { CountDownLatch latch = stopped ; Thread oldThread = thread . getAndUpdate ( null ) ; if ( oldThread != null && latch != null ) { try { latch . await ( 10 , TimeUnit . SECONDS ) ; } catch ( InterruptedException e ) { Thread . interrupted ( ) ; } } }
stop this executor from executing , and block until the thread has completed all work ( or until the timeout has occurred ) . < p > calling this method when already stopped has no effect .
