Example usage for java.lang InterruptedException printStackTrace

List of usage examples for java.lang InterruptedException printStackTrace

Introduction

In this page you can find the example usage for java.lang InterruptedException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:Main.java

public static void sleep(int second) {
    try {//  w ww. j a v a 2  s. c om
        Thread.sleep(second * 1000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void runAfter(int msSeconds, Thread thread) {
    try {//ww w .  j a v  a2s .co  m
        Thread.sleep(msSeconds);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    thread.start();
}

From source file:Main.java

public static void sleep(long millis) {
    try {//from   w ww .  j av  a 2s.co m
        Thread.currentThread().sleep(millis);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static final void sleep(TimeUnit tu, long timeout) {
    try {//from  w  w  w . j  a v a  2s  .  co  m
        tu.sleep(timeout);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void sleep(long mills) {
    try {//from w w  w .j  a v a 2 s  .co  m
        Thread.sleep(mills);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void sleep(int seconds) {
    try {/*from   ww  w  .  j  ava2  s . c o  m*/
        TimeUnit.SECONDS.sleep(seconds);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void sleepForSomeTime(long time) {
    try {//from   w  w  w.j  a  v a2s  .  c  o m
        Thread.sleep(time);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void delay(int seconds) {
    try {/* w w  w  .j a  va  2s.  co  m*/
        // delay 1 second
        Thread.sleep(seconds * 1000);
    } catch (InterruptedException e) {
        e.printStackTrace();

    }
}

From source file:Main.java

public static void safeSleep(long second) {
    try {/* w w  w  .j  a  v a2s .co  m*/
        Thread.sleep(second * 1000L);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}

From source file:Main.java

static void awaitTermination(ExecutorService threadPool) {
    threadPool.shutdown();/* w  w  w  .  j a va  2s.  com*/
    try {
        threadPool.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}