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 waitSingle() {
    synchronized (SINGLE_SEMAPHORE) {
        try {/*from w  w  w .j a v  a  2  s  .co m*/
            SINGLE_SEMAPHORE.wait();
        } catch (InterruptedException iex) {
            iex.printStackTrace();
        }
    }
}

From source file:Main.java

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

From source file:Main.java

public static void sleepSeconds(int i) {
    try {//ww  w .  j  av  a2 s .co  m
        Thread.sleep(i * SECONDS);
    } catch (InterruptedException ignore) {
        ignore.printStackTrace();
    }
}

From source file:Main.java

public static void silentSleep(long timeout) {
    try {/* w w  w. ja v  a  2s . c  om*/
        Thread.sleep(timeout);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void threadSleep(long millis) {
    try {/*from  www .j a v a 2s. c o  m*/
        Thread.sleep(millis);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static boolean shutdown() {
    try {//from  ww w . ja v a  2  s.  co  m
        executorService.shutdown();
        return executorService.awaitTermination(STANDARD_THREAD_COUNT / 100, TimeUnit.SECONDS);
    } catch (InterruptedException e) {
        e.printStackTrace();
        return true;
    } finally {
        executorService = Executors.newFixedThreadPool(6);
    }
}

From source file:Main.java

public static synchronized String nextUniqueId() {
    long current = System.nanoTime();
    if (current == previousId) {
        try {/*from w ww .j  a v  a2  s. c  om*/
            Thread.sleep(0, 1);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        current = System.nanoTime();
    }
    previousId = current;
    return String.valueOf(current);
}

From source file:Main.java

/**
 * Just sleep/*from ww w .  j  a v  a  2 s .co m*/
 * @param ms amount of milliseconds to sleep
 */
private static void sleep(final long ms) {
    try {
        Thread.sleep(ms);
    } catch (final InterruptedException e) {
        e.printStackTrace();
    }
}

From source file:Main.java

/**
 * @param millis How long to sleep for in milliseconds.
 *///from  ww  w  .j  ava  2s . c o m
public static void sleep(int millis) {
    try {
        Thread.sleep(millis);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void clearResource(String targetDir) {
    String[] str = { "rm", "-r", targetDir };

    try {/*from  ww  w. j a  va2s .c  o m*/
        Process ps = Runtime.getRuntime().exec(str);
        try {
            ps.waitFor();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}