@ Override public void close ( ) { isOpen . set ( false ) ; Iterator < Future < ? > > iterator = futures . iterator ( ) ; while ( iterator . hasNext ( ) ) { Future < ? > future = iterator . next ( ) ; iterator . remove ( ) ; if ( ! future . isDone ( ) && ! future . isCancelled ( ) && ! future . cancel ( true ) ) { log . warn ( "Could not cancel " + future ) ; } } if ( shutdownOnClose ) { executorService . shutdownNow ( ) ; } }
Closes any tasks currently in progress