javatools.thread
Class ThreadManager
java.lang.Object
|
+--java.util.AbstractMap
|
+--java.util.HashMap
|
+--javatools.thread.ThreadManager
- All Implemented Interfaces:
- java.lang.Cloneable, ManagedThread, java.util.Map, Resetable, java.lang.Runnable, java.io.Serializable, Server
- public class ThreadManager
- extends java.util.HashMap
- implements ManagedThread
A class which starts off and manages a number of child threads. The child
threads are located from class names in the "thread" properties file. The
"threads" property in this properties file is a comma separated list of java
class names. Each class must implement ManagedThread interface and have a
constructor that takes ThreadManager as its first argument. This class will
then have a new instance created. Once all these objects are created you
will then be able to control them all together either by running each as a
thread or shutting them all down together etc.
- See Also:
- Serialized Form
Field Summary |
(package private) java.util.Properties |
props
|
(package private) java.lang.ThreadGroup |
threadGroup
|
Fields inherited from class java.util.HashMap |
|
Fields inherited from class java.util.AbstractMap |
|
Constructor Summary |
ThreadManager()
Start up all the sub-threads. |
Method Summary |
java.lang.String |
getName()
Gets the name attribute of the ThreadManager object |
static void |
main(java.lang.String[] args)
This is the main entry point when debugging, and probably when run on UNIX. |
void |
reset()
Clear all Caches |
void |
run()
Main processing method for the ThreadManager object |
void |
shutdown()
Shutdown |
Methods inherited from class java.util.HashMap |
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values |
Methods inherited from class java.util.AbstractMap |
equals, hashCode, toString |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
equals, hashCode |
props
java.util.Properties props
threadGroup
java.lang.ThreadGroup threadGroup
ThreadManager
public ThreadManager()
throws java.io.IOException
- Start up all the sub-threads. After that, the main thread just dies. It has
no further use.
- Throws:
java.io.IOException
- Description of Exception
main
public static void main(java.lang.String[] args)
throws java.io.IOException
- This is the main entry point when debugging, and probably when run on UNIX.
When run as a MS-Windows service this doesn't get called however.
- Parameters:
args
- Description of Parameter
- Throws:
java.io.IOException
- Description of Exception
getName
public java.lang.String getName()
- Gets the name attribute of the ThreadManager object
- Specified by:
getName
in interface ManagedThread
- Returns:
- The name value
run
public void run()
- Main processing method for the ThreadManager object
- Specified by:
run
in interface java.lang.Runnable
reset
public void reset()
throws ResetException
- Clear all Caches
- Specified by:
reset
in interface Resetable
- Throws:
ResetException
- Description of Exception
shutdown
public void shutdown()
- Shutdown
- Specified by:
shutdown
in interface Server