ch.bind.philib.lang
Class ThreadUtil

java.lang.Object
  extended by ch.bind.philib.lang.ThreadUtil

public abstract class ThreadUtil
extends Object

Author:
Philipp Meinen

Nested Class Summary
static class ThreadUtil.ForeverRunner
          Wrapper for a runnable.
 
Constructor Summary
protected ThreadUtil()
           
 
Method Summary
static boolean interruptAndJoin(Thread t)
           
static boolean interruptAndJoin(Thread t, long waitTime)
           
static void sleepUntilMs(long time)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadUtil

protected ThreadUtil()
Method Detail

sleepUntilMs

public static void sleepUntilMs(long time)
                         throws InterruptedException
Throws:
InterruptedException

interruptAndJoin

public static boolean interruptAndJoin(Thread t)
Parameters:
t - the thread which must be interrupted and joined with a default timeout
Returns:
true for OK, false in case of an error.

interruptAndJoin

public static boolean interruptAndJoin(Thread t,
                                       long waitTime)
Parameters:
t - the thread which must be interrupted
waitTime - a specific timeout for the join operation. A negative or zero value means to no timeout is implied.
Returns:
true for OK, false in case of an error.


Copyright © 2013. All Rights Reserved.