void awaitStabilityUninterruptibly ( long timeout , TimeUnit timeUnit ) throws TimeoutException { boolean interrupted = false ; try { long toWait = timeUnit . toMillis ( timeout ) ; long msTimeout = System . currentTimeMillis ( ) + toWait ; while ( true ) { if ( interrupted ) { toWait = msTimeout - System . currentTimeMillis ( ) ; } try { if ( toWait <= 0 || ! monitor . awaitStability ( toWait , TimeUnit . MILLISECONDS , failed , problems ) ) { throw new TimeoutException ( ) ; } break ; } catch ( InterruptedException e ) { interrupted = true ; } } } finally { if ( interrupted ) { Thread . currentThread ( ) . interrupt ( ) ; } } }
Await service container stability ignoring thread interruption .