Java Sleep sleepQuietly(long millis)

Here you can find the source of sleepQuietly(long millis)

Description

Sleeps for the specified number of milliseconds, catching and ignoring any InterruptedException.

License

Apache License

Declaration

public static long sleepQuietly(long millis) 

Method Source Code

//package com.java2s;
// Licensed under the Apache License, Version 2.0 (the "License");

public class Main {
    /**//from  www  .  j  av  a  2s  .c  om
     *  Sleeps for the specified number of milliseconds, catching and ignoring
     *  any <code>InterruptedException</code>. Returns the number of milliseconds
     *  actually slept.
     *
     *  @since 1.0.5
     */
    public static long sleepQuietly(long millis) {
        long start = System.currentTimeMillis();
        try {
            Thread.sleep(millis);
        } catch (InterruptedException ignored) {
            // ignored
        }
        return System.currentTimeMillis() - start;
    }
}

Related

  1. sleepNS(long ns)
  2. sleepOrCry(long timeToWait)
  3. sleepPeriod(double period)
  4. sleepQuietly(int millis)
  5. sleepQuietly(long millis)
  6. sleepQuietly(long ms)
  7. sleepQuite(long millis)
  8. sleepRandMs(int ms)
  9. sleepRandom(long floor, long ceiling)