|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.groboutils.util.thread.v1.LoopThread
For threads which loop endlessly (which is a common thing), this class implements the pause, start, and stop routines since JDK 1.2 deprecated theirs.
This class delegates the Thread object, so that this class doesn't have to emulate all those thread methods. In this way, a LoopThread should act just like a Thread.
Field Summary | |
static long |
MILLI_IN_SECOND
|
Constructor Summary | |
LoopThread()
Used in case the implementing class needs to postpone initialization until after the LoopThread construction. |
|
LoopThread(java.lang.Runnable loop)
|
|
LoopThread(java.lang.Runnable loop,
java.lang.String threadName)
|
|
LoopThread(java.lang.Runnable loop,
java.lang.ThreadGroup group)
|
|
LoopThread(java.lang.Runnable loop,
java.lang.ThreadGroup group,
java.lang.String threadName)
|
Method Summary | |
int |
getPriority()
|
int |
getSleepTime()
Retrieves the sleep time in seconds. |
long |
getSleepTimeMillis()
Retrieves the sleep time in milliseconds. |
java.lang.ThreadGroup |
getThreadGroup()
|
boolean |
isAlive()
|
boolean |
isDaemon()
|
boolean |
isPaused()
|
boolean |
isRunning()
|
void |
join()
|
void |
resume()
|
void |
setDaemon(boolean on)
|
void |
setPriority(int priority)
|
void |
setRunnable(java.lang.Runnable run)
Sets the runnable instance after construction. |
void |
setSleepTime(int seconds)
Sets the sleep time in seconds. |
void |
setSleepTimeMillis(long millis)
Sets the sleep time in milliseconds. |
void |
start()
|
void |
stop()
|
void |
suspend()
A non-deprecated, nice-to-the-system, thread suspension method. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final long MILLI_IN_SECOND
Constructor Detail |
public LoopThread()
public LoopThread(java.lang.Runnable loop)
public LoopThread(java.lang.Runnable loop, java.lang.String threadName)
public LoopThread(java.lang.Runnable loop, java.lang.ThreadGroup group)
public LoopThread(java.lang.Runnable loop, java.lang.ThreadGroup group, java.lang.String threadName)
Method Detail |
public int getPriority()
Thread.getPriority()
public void setPriority(int priority)
Thread.setPriority( int )
public java.lang.ThreadGroup getThreadGroup()
Thread.getThreadGroup()
public boolean isAlive()
Thread.isAlive()
public boolean isDaemon()
Thread.isDaemon()
public void setDaemon(boolean on)
Thread.setDaemon( boolean )
public void join() throws java.lang.InterruptedException
java.lang.InterruptedException
Thread.join()
public void setRunnable(java.lang.Runnable run)
public void start()
Thread.start()
public void suspend()
Thread.suspend()
public void resume()
Thread.resume()
public void stop()
Thread.stop()
public boolean isPaused()
public boolean isRunning()
public int getSleepTime()
public void setSleepTime(int seconds)
public void setSleepTimeMillis(long millis)
public long getSleepTimeMillis()
public java.lang.String toString()
Thread.toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |