ch.bind.philib.lang
Class ThreadUtil

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

public abstract class ThreadUtil
extends Object

TODO

Author:
Philipp Meinen

Constructor Summary
protected ThreadUtil()
           
 
Method Summary
static Thread createAndStartForeverRunner(Runnable runnable)
           
static Thread createAndStartForeverRunner(Runnable runnable, String threadName)
           
static Thread createAndStartForeverRunner(ThreadGroup group, Runnable runnable, String threadName)
           
static Thread createAndStartForeverRunner(ThreadGroup group, Runnable runnable, String threadName, long stackSize)
           
static Thread createForeverRunner(Runnable runnable)
           
static Thread createForeverRunner(Runnable runnable, String threadName)
           
static Thread createForeverRunner(ThreadGroup group, Runnable runnable, String threadName)
           
static Thread createForeverRunner(ThreadGroup group, Runnable runnable, String threadName, long stackSize)
           
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.

createForeverRunner

public static Thread createForeverRunner(Runnable runnable)

createForeverRunner

public static Thread createForeverRunner(Runnable runnable,
                                         String threadName)

createForeverRunner

public static Thread createForeverRunner(ThreadGroup group,
                                         Runnable runnable,
                                         String threadName)

createForeverRunner

public static Thread createForeverRunner(ThreadGroup group,
                                         Runnable runnable,
                                         String threadName,
                                         long stackSize)

createAndStartForeverRunner

public static Thread createAndStartForeverRunner(Runnable runnable)

createAndStartForeverRunner

public static Thread createAndStartForeverRunner(Runnable runnable,
                                                 String threadName)

createAndStartForeverRunner

public static Thread createAndStartForeverRunner(ThreadGroup group,
                                                 Runnable runnable,
                                                 String threadName)

createAndStartForeverRunner

public static Thread createAndStartForeverRunner(ThreadGroup group,
                                                 Runnable runnable,
                                                 String threadName,
                                                 long stackSize)


Copyright © 2013. All Rights Reserved.