public static void pause ( long milli ) { final Thread t = Thread . currentThread ( ) ; long start = System . currentTimeMillis ( ) ; while ( System . currentTimeMillis ( ) - start < milli ) { synchronized ( t ) { try { long target = milli - ( System . currentTimeMillis ( ) - start ) ; if ( target > 0 ) t . wait ( target ) ; } catch ( InterruptedException ignore ) { } } } }
Invokes wait until the elapsed time has passed . In the thread is interrupted the interrupt is ignored .