appl.parallel.thread
Class OneMethodThread

java.lang.Object
  extended by appl.parallel.thread.OneMethodThread
All Implemented Interfaces:
Runnable

public abstract class OneMethodThread
extends Object
implements Runnable

Executes a method call in a single Thread

Author:
Dominik Appl

Field Summary
protected  Object executionResult
           
 
Constructor Summary
OneMethodThread(String threadName, int priority, Object... parameters)
          Creates a new Thread.
 
Method Summary
 Object getExecutionResult()
          the execution result must be explicitly set in the run() method.
 Object getParameter(int paraNo)
           
 void join()
          waits until the encapulated Thread has finished
abstract  void run()
           
 void start()
          Starts the thread
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

executionResult

protected Object executionResult
Constructor Detail

OneMethodThread

public OneMethodThread(String threadName,
                       int priority,
                       Object... parameters)
Creates a new Thread. Do not forget to start() it.

Parameters:
threadName - a name for the thread (usefull while debugging)
priority - a priority for the Thread
parameters - the parameters may be used later in the run method by calling the getParameter(int) method
Method Detail

run

public abstract void run()
Specified by:
run in interface Runnable

start

public void start()
Starts the thread


getParameter

public Object getParameter(int paraNo)
Parameters:
paraNo - the position in the given parameter array
Returns:
the parameter given in the constructor

join

public void join()
waits until the encapulated Thread has finished


getExecutionResult

public Object getExecutionResult()
the execution result must be explicitly set in the run() method.

Returns:
the result