public static void shutdownAndAwaitTermination ( ) { shutdown ( ) ; if ( pool != null ) { try { // wait a while for existing tasks to terminate if ( ! pool . awaitTermination ( 60L , TimeUnit . SECONDS ) ) { pool . shutdownNow ( ) ; // cancel currently executing tasks // wait a while for tasks to respond to being canceled if ( ! pool . awaitTermination ( 60L , TimeUnit . SECONDS ) ) { logger . warn ( "BioJava ConcurrencyTools thread pool did not terminate" ) ; } } } catch ( InterruptedException ie ) { pool . shutdownNow ( ) ; // (re-)cancel if current thread also interrupted Thread . currentThread ( ) . interrupt ( ) ; // preserve interrupt status } } }
Closes the thread pool . Waits 1 minute for a clean exit ; if necessary waits another minute for cancellation .