|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.innig.util.ThreadFlock
public class ThreadFlock
Creates a collection of threads running the same Runnable.
The threads have the same priority and the same daemon status.
You can start, interrupt, and join the threads en masse.
| Maturity: This is a moderately mature API, and a stable implementation. It's worked well in a number of informal tests, but has not been through methodical or real-world testing. |
| Plans: Write methodical tests. Try it in a real-world application. Fix stuff. |
| Constructor Summary | |
|---|---|
ThreadFlock(java.lang.Runnable runnable)
Creates a new flock with one thread. |
|
ThreadFlock(java.lang.Runnable runnable,
int threadCount)
Creates a new flock with an arbitrary number of threads. |
|
ThreadFlock(java.lang.Thread thread)
Creates a new flock with one thread. |
|
ThreadFlock(java.lang.Thread thread,
int threadCount)
Creates a new flock with an arbitrary number of threads. |
|
| Method Summary | |
|---|---|
int |
getPriority()
Returns the priority of the threads in this flock. |
int |
getThreadCount()
Returns the number of threads in this flock. |
void |
interrupt()
Interrupts all the threads in the flock. |
boolean |
isDaemon()
Determines whether the threads in this flock are daemons. |
void |
join(long time)
Waits for all the threads in the flock to die. |
void |
setDaemon(boolean daemon)
Changes whether the threads in this flock are daemons. |
void |
setPriority(int priority)
Sets the priority of all the threads in this flock. |
void |
setThreadCount(int threadCount,
boolean start)
Sets the number of threads in this flock. |
void |
start()
Starts all the threads in the flock. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ThreadFlock(java.lang.Runnable runnable)
start().
public ThreadFlock(java.lang.Runnable runnable,
int threadCount)
start().
public ThreadFlock(java.lang.Thread thread)
start().
public ThreadFlock(java.lang.Thread thread,
int threadCount)
start().
| Method Detail |
|---|
public int getThreadCount()
public void setThreadCount(int threadCount,
boolean start)
interrupt
the appropriate number of threads.
public int getPriority()
Thread.getPriority()public void setPriority(int priority)
setThreadCount.
Thread.setPriority(int)public boolean isDaemon()
Thread.isDaemon()public void setDaemon(boolean daemon)
setThreadCount.
Thread.setDaemon(boolean)public void start()
Thread.start()public void interrupt()
Thread.interrupt()
public void join(long time)
throws java.lang.InterruptedException
java.lang.InterruptedExceptionThread.join(long)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||