suramadu.util.exec
Class JavaThreadLauncher

java.lang.Object
  extended bysuramadu.util.exec.JavaThreadLauncher
All Implemented Interfaces:
ThreadLauncher
Direct Known Subclasses:
RTThreadLauncher

public class JavaThreadLauncher
extends java.lang.Object
implements ThreadLauncher

Utility used to launch threads. It requires a Runnable object the type of thread you want to run in and the priority to run at. It will create the Thread, SchedulingParameters, ReleaseParameters MemoryParameters MemoryArea and ProcessingGroupParameters. It will the start and join to the thread.

Version:
$Id: JavaThreadLauncher.html,v 1.1 2004/09/23 15:35:05 mbi Exp $
Author:
briang

Constructor Summary
JavaThreadLauncher()
          Creates a new instance of Launcher
JavaThreadLauncher(java.lang.Runnable runnable)
          Creates a new instance of Launcher
JavaThreadLauncher(java.lang.Runnable runnable, int priority)
          Creates a new instance of Launcher
JavaThreadLauncher(java.lang.Runnable runnable, int priority, long period)
          Creates a new instance of Launcher
JavaThreadLauncher(java.lang.Runnable runnable, int priority, long period, long initialDelay)
          Creates a new instance of Launcher
JavaThreadLauncher(ThreadLauncherData data)
          Creates a new instance of Launcher
JavaThreadLauncher(ThreadType tt, MemoryType mt, java.lang.Runnable runnable)
          Creates a new instance of Launcher
JavaThreadLauncher(ThreadType tt, MemoryType mt, java.lang.Runnable runnable, int priority)
          Creates a new instance of Launcher
JavaThreadLauncher(ThreadType tt, MemoryType mt, java.lang.Runnable runnable, int priority, long period)
          Creates a new instance of Launcher
JavaThreadLauncher(ThreadType tt, MemoryType mt, java.lang.Runnable runnable, int priority, long period, long initialDelay)
          Creates a new instance of Launcher
JavaThreadLauncher(ThreadType tt, java.lang.Runnable runnable)
          Creates a new instance of Launcher
JavaThreadLauncher(ThreadType tt, java.lang.Runnable runnable, int priority)
          Creates a new instance of Launcher
JavaThreadLauncher(ThreadType tt, java.lang.Runnable runnable, int priority, long period)
          Creates a new instance of Launcher
JavaThreadLauncher(ThreadType tt, java.lang.Runnable runnable, int priority, long period, long initialDelay)
          Creates a new instance of Launcher
 
Method Summary
 long getInitialDelay()
           
 int getIterations()
           
 MemoryType getMemoryType()
           
 long getPeriod()
           
 int getPriority()
           
 java.lang.Runnable getRunnable()
           
 java.lang.Thread getThread()
           
 ThreadType getThreadType()
           
 void kill()
          Kill the launched thread appropriately for its type.
 java.lang.Thread launch()
          Launches the test.
 java.lang.Thread launchDaemon()
          Creates the Thread, SchedulingParameters, ReleaseParameters MemoryParameters MemoryArea and ProcessingGroupParameters.
 void setData(ThreadLauncherData data)
           
 void setInitialDelay(long d)
           
 void setIterations(int iterations)
           
 void setMemoryType(MemoryType mt)
           
 void setPeriod(long p)
           
 void setPriority(int p)
           
 void setRunnable(java.lang.Runnable runnable)
          Setters and getters for member fields
 void setThreadType(ThreadType tt)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JavaThreadLauncher

public JavaThreadLauncher()
Creates a new instance of Launcher


JavaThreadLauncher

public JavaThreadLauncher(ThreadLauncherData data)
Creates a new instance of Launcher

Parameters:
data - initialize from data structure

JavaThreadLauncher

public JavaThreadLauncher(java.lang.Runnable runnable)
Creates a new instance of Launcher

Parameters:
runnable - the object to run in the created thread. The deafult

JavaThreadLauncher

public JavaThreadLauncher(java.lang.Runnable runnable,
                          int priority)
Creates a new instance of Launcher

Parameters:
runnable - the object to run in the created thread.
priority - the priority of the thread in question. the deafult priority is PriorityScheduler.MAX_PRIORITY.

JavaThreadLauncher

public JavaThreadLauncher(java.lang.Runnable runnable,
                          int priority,
                          long period)
Creates a new instance of Launcher

Parameters:
runnable - the object to run in the created thread.
priority - the priority of the thread in question. the deafult priority is PriorityScheduler.MAX_PRIORITY.
period - the period in milliseconds.

JavaThreadLauncher

public JavaThreadLauncher(java.lang.Runnable runnable,
                          int priority,
                          long period,
                          long initialDelay)
Creates a new instance of Launcher

Parameters:
runnable - the object to run in the created thread.
priority - the priority of the thread in question. the deafult priority is PriorityScheduler.MAX_PRIORITY.
period - the period in milliseconds.
initialDelay - the initialDelay in milliseconds.

JavaThreadLauncher

public JavaThreadLauncher(ThreadType tt,
                          java.lang.Runnable runnable)
Creates a new instance of Launcher

Parameters:
tt - the ThreadType of the thread to create.
runnable - Runnable the object to run in the created thread. The deafult Launcher.ThreadType is REALTIMETHREAD the deafault MemoryArea is Heap and the deafult priority is PriorityScheduler.MAX_PRIORITY.

JavaThreadLauncher

public JavaThreadLauncher(ThreadType tt,
                          java.lang.Runnable runnable,
                          int priority)
Creates a new instance of Launcher

Parameters:
tt - the ThreadType of the thread to create.
runnable - Runnable the object to run in the created thread.
priority - the priority of the thread in question. the deafult priority is PriorityScheduler.MAX_PRIORITY.

JavaThreadLauncher

public JavaThreadLauncher(ThreadType tt,
                          java.lang.Runnable runnable,
                          int priority,
                          long period)
Creates a new instance of Launcher

Parameters:
tt - the ThreadType of the thread to create.
runnable - the object to run in the created thread.
priority - the priority of the thread in question. the deafult priority is PriorityScheduler.MAX_PRIORITY.
period - the period in milliseconds.

JavaThreadLauncher

public JavaThreadLauncher(ThreadType tt,
                          java.lang.Runnable runnable,
                          int priority,
                          long period,
                          long initialDelay)
Creates a new instance of Launcher

Parameters:
tt - the ThreadType of the thread to create.
runnable - the object to run in the created thread.
priority - the priority of the thread in question. the deafult priority is PriorityScheduler.MAX_PRIORITY.
period - the period in milliseconds.
initialDelay - the initialDelay in milliseconds.

JavaThreadLauncher

public JavaThreadLauncher(ThreadType tt,
                          MemoryType mt,
                          java.lang.Runnable runnable)
Creates a new instance of Launcher

Parameters:
tt - the ThreadType of the thread to create.
mt - the MemoryType in which to execute the created thread.
runnable - the object to run in the created thread. The deafult Launcher.ThreadType is REALTIMETHREAD the deafault MemoryArea is Heap and the deafult priority is PriorityScheduler.MAX_PRIORITY.

JavaThreadLauncher

public JavaThreadLauncher(ThreadType tt,
                          MemoryType mt,
                          java.lang.Runnable runnable,
                          int priority)
Creates a new instance of Launcher

Parameters:
tt - the ThreadType of the thread to create.
mt - the MemoryType in which to execute the created thread.
runnable - the object to run in the created thread.
priority - the priority of the thread in question. the deafult priority is PriorityScheduler.MAX_PRIORITY.

JavaThreadLauncher

public JavaThreadLauncher(ThreadType tt,
                          MemoryType mt,
                          java.lang.Runnable runnable,
                          int priority,
                          long period)
Creates a new instance of Launcher

Parameters:
tt - the ThreadType of the thread to create.
mt - the MemoryType in which to execute the created thread.
runnable - the object to run in the created thread.
priority - the priority of the thread in question. the deafult priority is PriorityScheduler.MAX_PRIORITY.
period - the period in milliseconds.

JavaThreadLauncher

public JavaThreadLauncher(ThreadType tt,
                          MemoryType mt,
                          java.lang.Runnable runnable,
                          int priority,
                          long period,
                          long initialDelay)
Creates a new instance of Launcher

Parameters:
tt - the ThreadType of the thread to create.
mt - the MemoryType in which to execute the created thread.
runnable - the object to run in the created thread.
priority - the priority of the thread in question. the deafult priority is PriorityScheduler.MAX_PRIORITY.
period - the period in milliseconds.
initialDelay - the initialDelay in milliseconds.
Method Detail

setRunnable

public void setRunnable(java.lang.Runnable runnable)
Setters and getters for member fields


getRunnable

public java.lang.Runnable getRunnable()

setIterations

public void setIterations(int iterations)
Specified by:
setIterations in interface ThreadLauncher

getIterations

public int getIterations()
Specified by:
getIterations in interface ThreadLauncher

setMemoryType

public void setMemoryType(MemoryType mt)
Specified by:
setMemoryType in interface ThreadLauncher

getMemoryType

public MemoryType getMemoryType()
Specified by:
getMemoryType in interface ThreadLauncher

getThread

public java.lang.Thread getThread()
Specified by:
getThread in interface ThreadLauncher

setThreadType

public void setThreadType(ThreadType tt)
Specified by:
setThreadType in interface ThreadLauncher

getThreadType

public ThreadType getThreadType()
Specified by:
getThreadType in interface ThreadLauncher

setPriority

public void setPriority(int p)
Specified by:
setPriority in interface ThreadLauncher

getPriority

public int getPriority()
Specified by:
getPriority in interface ThreadLauncher

setPeriod

public void setPeriod(long p)
Specified by:
setPeriod in interface ThreadLauncher

getPeriod

public long getPeriod()
Specified by:
getPeriod in interface ThreadLauncher

setInitialDelay

public void setInitialDelay(long d)
Specified by:
setInitialDelay in interface ThreadLauncher

getInitialDelay

public long getInitialDelay()
Specified by:
getInitialDelay in interface ThreadLauncher

launch

public java.lang.Thread launch()
Launches the test. Creates the Thread, SchedulingParameters, ReleaseParameters MemoryParameters MemoryArea and ProcessingGroupParameters. It will the start he thread.

Specified by:
launch in interface ThreadLauncher
Returns:
the thread that was launched.

launchDaemon

public java.lang.Thread launchDaemon()
Creates the Thread, SchedulingParameters, ReleaseParameters MemoryParameters MemoryArea and ProcessingGroupParameters. It will the start the thread as a Deamom

Specified by:
launchDaemon in interface ThreadLauncher
Returns:
the thread that was launched.

kill

public void kill()
Kill the launched thread appropriately for its type.

Specified by:
kill in interface ThreadLauncher

setData

public void setData(ThreadLauncherData data)
Specified by:
setData in interface ThreadLauncher
See Also:
ThreadLauncher.setData(suramadu.util.exec.ThreadLauncherData)

toString

public java.lang.String toString()
Returns:
a string representing the contents of this class.