public void check ( ) throws InterruptedException , ExecutionException { // If a thread threw an uncaught exception, re-throw it. final ExecutionException executionException = getExecutionException ( ) ; if ( executionException != null ) { throw executionException ; } // If this thread or another thread has been interrupted, throw InterruptedException if ( checkAndReturn ( ) ) { throw new InterruptedException ( ) ; } }
Check if this thread or any other thread that shares this InterruptionChecker instance has been interrupted or has thrown an exception and if so throw InterruptedException .