|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sibvisions.util.ThreadHandler
public class ThreadHandler
The ThreadHandler
manages threads. The threads get a
meaningful name and will be stored in an internal list. The handler
can stop and start new threads.
It should be used to collect all threads of an application. The access
to the thread cache is synchronized.
Constructor Summary | |
---|---|
protected |
ThreadHandler()
Constructor only for inherited classes, because the ThreadHandler class is a utility class. |
Method Summary | |
---|---|
static boolean |
add(Thread pThread)
Adds a thread to the "known" thread list if not already added. |
static boolean |
addIntern(Thread pThread)
Adds a thread to the "known" thread list if not already added. |
static List<Thread> |
getPendingStoppedThreads()
Gets all pending stopped threads which are already alive. |
static List<Thread> |
getRunningThreads()
Gets all "known" and alive threads. |
static boolean |
isStopped()
Gets if the current thread is stopped. |
static boolean |
isStopped(Thread pThread)
Gets if a desired thread is stopped. |
static void |
remove(Thread pThread)
Removes a thread from the "known" thread list. |
static Thread |
start(Runnable pRunnable)
Starts a thread and adds it to the "known" threads. |
static void |
stop()
Stops/interrupts all "known" threads. |
static Thread |
stop(Thread pThread)
Stops/interrupts a thread and removes it from the "known" threads. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected ThreadHandler()
ThreadHandler
class is a utility class.
Method Detail |
---|
public static boolean add(Thread pThread)
ThreadHandler
can interrupt and list all user-defined threads.
pThread
- the thread, which is to be added
true
if the thread was added, otherwise false
public static boolean addIntern(Thread pThread)
pThread
- the thread, which is to be added
true
if the thread was added, otherwise false
public static void remove(Thread pThread)
pThread
- the car, which is to be removedpublic static Thread start(Runnable pRunnable)
pRunnable
- a Thread
or another Runnable
implementation
Thread
with the pRunnable
or pRunnable
if it's an instance of Thread
and the thread is still alive.
IllegalStateException
- if the pRunnable
is an instance of a finished Thread
getRunningThreads()
public static Thread stop(Thread pThread)
pThread
- the thread, which is to be stopped
null
getPendingStoppedThreads()
public static void stop()
stop(Thread)
public static boolean isStopped()
true
if the current thread is stopped, otherwise false
public static boolean isStopped(Thread pThread)
pThread
- the thread
true
if pThread
is stopped or pThread == null
, otherwise false
public static List<Thread> getPendingStoppedThreads()
public static List<Thread> getRunningThreads()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |