List of usage examples for java.lang InterruptedException printStackTrace
public void printStackTrace()
From source file:Main.java
/** * sleeps without interruption exception *//*from ww w .j a v a 2s.c o m*/ public static void sleep(int millis) { long start = System.currentTimeMillis(); while (true) { long toWait = millis + start - System.currentTimeMillis(); if (toWait < 0) return; try { Thread.sleep(toWait); return; } catch (InterruptedException e) { e.printStackTrace(); } } }
From source file:Main.java
/** * Causes the currently executing thread to sleep (temporarily cease * execution) for the specified number of milliseconds. * /*from w ww .j a v a 2s .c om*/ * @param millis */ public static void sleep(long millis) { try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } }
From source file:Main.java
public static void debugWait(long time) { if (!debug)/*from ww w . j a v a2s . c o m*/ return; if (wait == null) wait = new Object(); synchronized (wait) { try { wait.wait(time); } catch (InterruptedException e) { e.printStackTrace(); } } }
From source file:com.espertech.esper.regression.client.MyMetricFunctions.java
public static boolean takeWallTime(long msecTarget) { try {/* ww w . ja va 2 s .c o m*/ Thread.sleep(msecTarget); } catch (InterruptedException e) { e.printStackTrace(); } return true; }
From source file:Main.java
/** * Puts the current thread to sleep for the specified amount of time. * * @param sleepTime//www .java2s . c o m * in milliseconds */ public static void sleep(long sleepTime) { Thread currentThread = Thread.currentThread(); try { Thread.sleep(sleepTime); } catch (InterruptedException e) { e.printStackTrace(); currentThread.interrupt(); } }
From source file:com.test.util.ThreadUtils.java
public static void sleep(long duration) { try {/*from www. j a va 2 s . c o m*/ Thread.sleep(duration); } catch (InterruptedException e) { e.printStackTrace(); } }
From source file:Main.java
public static void sleep(long ms) { try {/*from w ww.ja va2 s . c o m*/ Thread.sleep(ms); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:Main.java
public static void calculation(long time) { //ensure that it doesn't take all of the processor power try {//from w ww.j a va2s . c o m Thread.sleep(time); } catch (InterruptedException e) { // Debug.error(e); e.printStackTrace(); } }
From source file:Main.java
public static void sleep(long time) { try {//w ww .ja v a2 s.c om Thread.currentThread(); Thread.sleep(time); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:Main.java
/** * Waits for all threads to complete computation. * /*from www . j a v a 2 s. c o m*/ * @param futures */ public static void waitForCompletion(Future<?>[] futures) { int size = futures.length; try { for (int j = 0; j < size; j++) futures[j].get(); } catch (ExecutionException ex) { ex.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } }