public static void sleepUninterruptibly(final long timeout, final TimeUnit unit) {
        N.checkArgNotNull(unit, "unit");

        if (timeout <= 0) {
            return;
        }

        boolean interrupted = false;

        try {
            long remainingNanos = unit.toNanos(timeout);
            final long sysNanos = System.nanoTime();
            final long end = remainingNanos >= Long.MAX_VALUE - sysNanos ? Long.MAX_VALUE : sysNanos + remainingNanos;

            while (true) {
                try {
                    // TimeUnit.sleep() treats negative timeouts just like zero.
                    TimeUnit.NANOSECONDS.sleep(remainingNanos);
                    return;
                } catch (InterruptedException e) {
                    interrupted = true;
                    remainingNanos = end - System.nanoTime();
                }
            }
        } finally {
            if (interrupted) {
                Thread.currentThread().interrupt();
            }
        }
    }
public static void sleepUninterruptibly ( final long timeout , final TimeUnit unit ) { N . checkArgNotNull ( unit , "unit" ) ; if ( timeout <= 0 ) { return ; } boolean interrupted = false ; try { long remainingNanos = unit . toNanos ( timeout ) ; final long sysNanos = System . nanoTime ( ) ; final long end = remainingNanos >= Long . MAX_VALUE - sysNanos ? Long . MAX_VALUE : sysNanos + remainingNanos ; while ( true ) { try { TimeUnit . NANOSECONDS . sleep ( remainingNanos ) ; return ; } catch ( InterruptedException e ) { interrupted = true ; remainingNanos = end - System . nanoTime ( ) ; } } } finally { if ( interrupted ) { Thread . currentThread ( ) . interrupt ( ) ; } } }
Note: Copied from Google Guava under Apache License v2.0
<br />
<br />

If a thread is interrupted during such a call, the call continues to block until the result is available or the
timeout elapses, and only then re-interrupts the thread.

@param timeoutInMillis