Java Sleep sleepForReal(long time)

Here you can find the source of sleepForReal(long time)

Description

sleep For Real

License

Open Source License

Declaration

public static void sleepForReal(long time) throws InterruptedException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static void sleepForReal(long time) throws InterruptedException {
        long end = System.currentTimeMillis() + time;
        while (true) {
            long now = System.currentTimeMillis();
            if (now >= end)
                return;
            Thread.sleep(end - now);
        }/*from ww  w .ja  v  a 2  s  . com*/
    }
}

Related

  1. sleepForAuditGranularity()
  2. sleepForever()
  3. sleepForever()
  4. sleepForever()
  5. sleepForIOCatchup()
  6. sleepForSecs(double numSecs)
  7. sleepForSomeTime(long milliseconds)
  8. sleepForTimestamp()
  9. sleepIgnoreInterupt(long millis)