uk.ac.ic.doc.automed.util.thread
Class AsynchThread

java.lang.Object
  extended by java.lang.Thread
      extended by uk.ac.ic.doc.automed.util.thread.AsynchThread
All Implemented Interfaces:
java.lang.Runnable

public class AsynchThread
extends java.lang.Thread


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
AsynchThread(java.lang.String name, Threadable threadableObj)
          Creates a new instance of TimedThread
 
Method Summary
static java.lang.String getDefaultName()
          Return the default, unique name for a thread
static int getNextID()
          Get the next id counter for a new thread
 boolean isStopped()
          Check if a thread is started or not
 void restartThread()
          To restart, stop and start it
 void run()
          Implements the thread-running method
 void startThread()
          Start (rather resume) a thread's operation
 void stopThread()
          Stop (rather pause) a thread
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AsynchThread

public AsynchThread(java.lang.String name,
                    Threadable threadableObj)
Creates a new instance of TimedThread

Parameters:
name - a meaningful name for thread object
id - a unique thread's id
sleepTime - a sleep time in seconds
threadableObj - a thread-handling object
daemon - whether or not to create a daemon-like thread
Method Detail

stopThread

public void stopThread()
Stop (rather pause) a thread


startThread

public void startThread()
Start (rather resume) a thread's operation


isStopped

public boolean isStopped()
Check if a thread is started or not


restartThread

public void restartThread()
To restart, stop and start it


run

public void run()
Implements the thread-running method

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

getDefaultName

public static java.lang.String getDefaultName()
Return the default, unique name for a thread

Returns:
String default thread's name

getNextID

public static int getNextID()
Get the next id counter for a new thread

Returns:
int next thread's id