Here you can find the source of sleepAndCachedInterruptedException(long sleepFor, TimeUnit unit)
Parameter | Description |
---|---|
millis | a parameter |
public final static boolean sleepAndCachedInterruptedException(long sleepFor, TimeUnit unit)
//package com.java2s; //License from project: Apache License import java.util.concurrent.TimeUnit; public class Main { /**/*from ww w . ja v a2 s . c o m*/ * Sleep and cached InterruptedException. * * @param millis * @return true:normal end, false: Interrupted */ public final static boolean sleepAndCachedInterruptedException(long sleepFor, TimeUnit unit) { if (sleepFor <= 0) { return true; } try { unit.sleep(sleepFor); return true; } catch (InterruptedException e) { // omit return false; } } }