oemware.core
Class MultiThread

java.lang.Object
  extended by oemware.core.MultiThread
All Implemented Interfaces:
java.lang.Runnable

public abstract class MultiThread
extends java.lang.Object
implements java.lang.Runnable

The multiple thread object. This creates multiple threads of the extended class, and runs them.


Constructor Summary
MultiThread(int pThreadCount, java.lang.String pThreadName)
          Create a new object with params.
MultiThread(int pThreadCount, java.lang.String pThreadName, int pThreadPriority, boolean pJoinThread)
          Create a new object with params.
MultiThread(long pSleepTime, int pThreadCount, java.lang.String pThreadName, int pThreadPriority, boolean pJoinThread)
          Create the new object.
MultiThread(java.lang.String pThreadName)
          Create a new object with params.
MultiThread(java.lang.String pThreadName, long pSleepTime)
          Create a new object with params.
 
Method Summary
abstract  void execute()
          This is implemented by the extending class.
 int getThreadCount()
          Returns the thread count.
 boolean isRunning()
          Returns true if the thread is running.
 void run()
          The run method.
 void setThreadCount(int pCount)
          Set the thread count.
 void shutdown()
          Shutdown the component.
 void startup()
          Start the component/threads.
 void stopRunning()
          Set the running flag to false.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiThread

public MultiThread(long pSleepTime,
                   int pThreadCount,
                   java.lang.String pThreadName,
                   int pThreadPriority,
                   boolean pJoinThread)
Create the new object.

Parameters:
pSleepTime - The sleep time.
pThreadCount - The thread count.
pThreadName - The thread name.
pThreadPriority - The thread priority.

MultiThread

public MultiThread(int pThreadCount,
                   java.lang.String pThreadName)
Create a new object with params.

Parameters:
pThreadCount - The thread count.
pThreadName - The thread name.

MultiThread

public MultiThread(java.lang.String pThreadName)
Create a new object with params.

Parameters:
pThreadName - The thread name.

MultiThread

public MultiThread(java.lang.String pThreadName,
                   long pSleepTime)
Create a new object with params.

Parameters:
pThreadName - The thread name.
pSleepTime - The sleep time.

MultiThread

public MultiThread(int pThreadCount,
                   java.lang.String pThreadName,
                   int pThreadPriority,
                   boolean pJoinThread)
Create a new object with params.

Parameters:
pThreadCount - The thread count.
pThreadName - The thread name.
pThreadPriority - The thread priority.
Method Detail

startup

public final void startup()
Start the component/threads.


isRunning

public final boolean isRunning()
Returns true if the thread is running.

Returns:
True if the thread is running.

stopRunning

public final void stopRunning()
Set the running flag to false.


shutdown

public void shutdown()
Shutdown the component.


run

public final void run()
The run method.

Specified by:
run in interface java.lang.Runnable

execute

public abstract void execute()
This is implemented by the extending class. It's called in the thread's run method in an infinite loop. It sleeps if configured to do so.


setThreadCount

public final void setThreadCount(int pCount)
Set the thread count. THis must be called before startup and does nothing after startup is called.

Parameters:
pCount - The number of threads to spawn.

getThreadCount

public final int getThreadCount()
Returns the thread count.

Returns:
The thread count.


Copyright © 2009 Deft Labs - Released under LGPL, Version 3.0