JavaGroups
Class ReusableThread

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--JavaGroups.ReusableThread

public class ReusableThread
extends java.lang.Thread

Reusable thread class. Instead of creating a new thread per task, this instance can be reused to run different tasks in turn. This is done by looping and assigning the Runnable target objects whose run method is then called.


Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ReusableThread()
           
 
Method Summary
 void AssignTask(java.lang.Runnable target)
           
 boolean Available()
           
 boolean Done()
           
 void finalize()
           
static void main(java.lang.String[] args)
           
 void run()
           
 void SetAvailable(boolean a)
           
 void Start()
           
 void Stop()
           
 void WaitUntilDone()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReusableThread

public ReusableThread()
Method Detail

Start

public void Start()

Stop

public void Stop()

finalize

public void finalize()

AssignTask

public void AssignTask(java.lang.Runnable target)

run

public void run()
Overrides:
run in class java.lang.Thread

SetAvailable

public void SetAvailable(boolean a)

Available

public boolean Available()

Done

public boolean Done()

WaitUntilDone

public void WaitUntilDone()

main

public static void main(java.lang.String[] args)