Here you can find the source of safeSleepMillis(long milliseconds)
Parameter | Description |
---|---|
milliseconds | the minimum number of milliseconds that the calling thread should be suspended for (the thread could conceivably be suspended for an arbitrary number of additional milliseconds depending upon far too many factors to enumerate here). |
public static void safeSleepMillis(long milliseconds)
//package com.java2s; //License from project: Apache License public class Main { /**/*from w ww.ja v a2 s . c o m*/ * Sleep for specified number of milliseconds without having to bother catching the InterruptedException potentially * thrown by the regular sleep method. * * @param milliseconds the minimum number of milliseconds that the calling thread should be suspended for (the * thread could conceivably be suspended for an arbitrary number of additional milliseconds * depending upon far too many factors to enumerate here). */ public static void safeSleepMillis(long milliseconds) { try { Thread.sleep(milliseconds); } catch (InterruptedException e) { //noinspection CallToPrintStackTrace e.printStackTrace(); } } }