public class WorkerThreadPool
extends java.lang.Object
Constructor and Description |
---|
WorkerThreadPool(AtomConsumer oAtomConsumer,
java.util.Properties oEnvironmentProps)
Create WorkerThreadPool
thread Pool size is readed from maxschedulerthreads property of oEnvironmentProps,
the default value is 1.
|
Modifier and Type | Method and Description |
---|---|
java.util.Properties |
getProperties()
Get Environment properties collection from hipergate.cnf
|
java.lang.String |
getProperty(java.lang.String sKey)
Get Environment property
|
long |
getRunningTimeMS() |
void |
haltAll()
Halt all pooled threads commiting any pending operations before stoping
If a thread is dead-locked by any reason halting it will not cause any effect.
|
void |
launchAll()
Launch all WorkerThreads and start consuming atoms from queue.
|
int |
livethreads()
Count of currently active WorkerThreads
|
void |
registerCallback(WorkerThreadCallback oNewCallback)
Register a thread callback object for each thread in this pool
|
Atom[] |
runningAtoms()
Get array of atoms currently running at live WorkerThreads
|
java.lang.String[] |
runningJobs()
Get array with GUIDs of Jobs currently run by live WorkerThreads
|
int |
size()
Get Pool Size
|
void |
stopAll()
Deprecated.
Use stopAll(JDCConnection) instead
|
void |
stopAll(JDCConnection oConn)
Call stop() on every thread of the pool which is alive
All running atoms are set to STATUS_INTERRUPTED
|
WorkerThread[] |
threads() |
void |
unregisterCallback(java.lang.String sCallbackName)
Unregister a thread callback object for each thread in this pool
|
public WorkerThreadPool(AtomConsumer oAtomConsumer, java.util.Properties oEnvironmentProps)
Create WorkerThreadPool
thread Pool size is readed from maxschedulerthreads property of oEnvironmentProps, the default value is 1. Each thread is given the name WorkerThread_noAtomConsumer
- Atom Consumer Object to be usedoEnvironmentProps
- Environment Properties collection
(usually readed from hipergate.cnf)public int size()
public java.util.Properties getProperties()
public java.lang.String getProperty(java.lang.String sKey)
public long getRunningTimeMS()
public void launchAll() throws java.lang.IllegalThreadStateException
java.lang.IllegalThreadStateException
public int livethreads()
public WorkerThread[] threads()
public Atom[] runningAtoms()
public java.lang.String[] runningJobs()
public void registerCallback(WorkerThreadCallback oNewCallback) throws java.lang.IllegalArgumentException
oNewCallback
- WorkerThreadCallback subclass instancejava.lang.IllegalArgumentException
- If a callback with same name has oNewCallback was already registeredpublic void unregisterCallback(java.lang.String sCallbackName)
sCallbackName
- Name of callback to be unregisteredpublic void haltAll()
Halt all pooled threads commiting any pending operations before stoping
If a thread is dead-locked by any reason halting it will not cause any effect.public void stopAll()
Call stop() on every thread of the pool which is alive
This method should only be used when threads cannot be stopped by calling haltAll()public void stopAll(JDCConnection oConn) throws java.sql.SQLException
Call stop() on every thread of the pool which is alive
All running atoms are set to STATUS_INTERRUPTEDjava.sql.SQLException