|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sibvisions.util.ThreadManager
public class ThreadManager
The ThreadManager
manages threads. The threads get a
meaningful name and will be stored in an internal list. The manager
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 | |
---|---|
ThreadManager()
Creates a new instance of ThreadManager . |
Method Summary | |
---|---|
boolean |
add(java.lang.Thread pThread)
Adds a thread to the "known" thread list if not already added. |
java.util.List<java.lang.Thread> |
getPendingStoppedThreads()
Gets all pending stopped threads which are already alive. |
java.util.List<java.lang.Thread> |
getRunningThreads()
Gets all "known" and alive threads. |
boolean |
isStopped()
Gets if the current thread is stopped. |
boolean |
isStopped(java.lang.Thread pThread)
Gets if a desired thread is stopped. |
void |
remove(java.lang.Thread pThread)
Removes a thread from the "known" thread list. |
java.lang.Thread |
start(java.lang.Runnable pRunnable)
Starts a thread and adds it to the "known" threads. |
void |
stop()
Stops/interrupts all "known" threads. |
java.lang.Thread |
stop(java.lang.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 |
---|
public ThreadManager()
ThreadManager
.
Method Detail |
---|
public boolean add(java.lang.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 void remove(java.lang.Thread pThread)
pThread
- the thread, which is to be removedpublic java.lang.Thread start(java.lang.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.
java.lang.IllegalStateException
- if the pRunnable
is an instance of a finished Thread
getRunningThreads()
public java.lang.Thread stop(java.lang.Thread pThread)
pThread
- the thread, which is to be stopped
null
getPendingStoppedThreads()
public void stop()
stop(Thread)
public boolean isStopped()
true
if the current thread is stopped, otherwise false
public boolean isStopped(java.lang.Thread pThread)
pThread
- the thread
true
if pThread
is stopped or pThread == null
, otherwise false
public java.util.List<java.lang.Thread> getPendingStoppedThreads()
public java.util.List<java.lang.Thread> getRunningThreads()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |