Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.knowgate.scheduler
Class WorkerThreadPool

    java.lang.Object
      com.knowgate.scheduler.WorkerThreadPool

    public class WorkerThreadPool

extends java.lang.Object

WorkerThread Pool

Constructor Summary
`WorkerThreadPool(AtomConsumer oAtomConsumer, java.util.Properties oEnvironmentProps)` Create WorkerThreadPool thread Pool size is readed from maxschedulerthreads property of oEnvironmentProps, the default value is 1.

Method Summary
`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

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### WorkerThreadPool

    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_n

  Parameters:
    `oAtomConsumer` - Atom Consumer Object to be used
    `oEnvironmentProps` - Environment Properties collection (usually readed from hipergate.cnf)

Method Detail

### size

    public int size()

  Get Pool Size

### getProperties

    public java.util.Properties getProperties()

  Get Environment properties collection from hipergate.cnf

### getProperty

    public java.lang.String getProperty(java.lang.String sKey)

  Get Environment property

  Returns:

### getRunningTimeMS

    public long getRunningTimeMS()

### launchAll

    public void launchAll()
                   throws java.lang.IllegalThreadStateException

  Launch all WorkerThreads and start consuming atoms from queue.

  Throws:
    `java.lang.IllegalThreadStateException`

### livethreads

    public int livethreads()

  Count of currently active WorkerThreads

### threads

    public WorkerThread[] threads()

### runningAtoms

    public Atom[] runningAtoms()

  Get array of atoms currently running at live WorkerThreads

  Returns:
    Atom[]
  Since:
    3.0

### runningJobs

    public java.lang.String[] runningJobs()

  Get array with GUIDs of Jobs currently run by live WorkerThreads

  Returns:
    String[] Job GUID array
  Since:
    3.0

### registerCallback

    public void registerCallback(WorkerThreadCallback oNewCallback)
                          throws java.lang.IllegalArgumentException

  Register a thread callback object for each thread in this pool

  Parameters:
    `oNewCallback` - WorkerThreadCallback subclass instance
  Throws:
    `java.lang.IllegalArgumentException` - If a callback with same name has oNewCallback was already registered

### unregisterCallback

    public void unregisterCallback(java.lang.String sCallbackName)

  Unregister a thread callback object for each thread in this pool

  Parameters:
    `sCallbackName` - Name of callback to be unregistered

### haltAll

    public 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.
  halt() method only sends a signals to the each WokerThread telling it that must finish pending operations and stop.

### stopAll

    public void stopAll()

  Deprecated. Use stopAll(JDCConnection) instead

  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()

### stopAll

    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_INTERRUPTED

  Throws:
    `java.sql.SQLException`
  Since:
    3.0

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD