IGLib 1.4
The IGLib base library for development of numerical, technical and business applications.

IG::Num::ParallelJobDispatcherBase Class Reference

Base class for parallel job dispatchers. Accepts job requests and dispatches jobs to parallel job servers when available and redy to run a job. More...

Inheritance diagram for IG::Num::ParallelJobDispatcherBase:
Collaboration diagram for IG::Num::ParallelJobDispatcherBase:

List of all members.

Public Member Functions

void IncrementNumSentJobs ()
 Increments by one the number of sent jobs (all jobs sent to the current dispatcher for execution).
void IncrementNumStartedJobs ()
 Increments by one the number of started by the dispatcher up to this point.
void IncrementNumFinishedJobs ()
 Increments by one the number of finished jobs (of those handled by the current dispatcher) up to this point.
void IncrementNumAbortedJobs ()
 Increments by one the number of aborted jobs (of those handled by the current dispatcher) up to this point.

Protected Member Functions

internal int GetNextJobId ()
 Generates and returns a new Job Id that is unique in the scope of the current dispatcher.
void ResetNumIdleJobServers ()
 Resets number of idle job servers to 0.
internal void IncrementNumIdleJobServers ()
 Increments by one the number of idle job servers that are currently available on the dispatcher.
internal void DecrementNumIdleJobServers ()
 Decrements by one the number of idle job servers that are currently available on the dispatcher.

Static Protected Member Functions

static int GetNextId ()
 Returns another ID that is unique for objects of the containing class its and derived classes.

Protected Attributes

readonly object ServersLock = new object()
 Lock that is usef for locking code that can be run from servers. List of idle servers is locked by this lock, as well as various data that is accessed on job start, abort or finished events on servers, such as number of started jobs.
volatile int _outputLevel = ParallelJobContainerBase.DefaultOutputLevel
 Output level for objects of this class. Specifies how much output is printed to console during operation.
bool _isTestMode = ParallelJobContainerBase.DefaultIsTestMode
int _sleepTimeMs = DefaultSleepTimeMs
int _numSentJobs = 0

Properties

object Lock [get]
 This object's central lock object to be used by other object. Do not use this object for locking in class' methods, for this you should use InternalLock.
static int DefaultOutputLevel [get, set]
 Default output level for objects of this and derived types. Just aliases the ParallelJobContainerBase.DefaultOutputLevel.
int OutputLevel [get, set]
 Output level the current object. Specifies how much output is printed to console during operation.
static bool DefaultIsTestMode [get, set]
 Default value of test mode flag. Just aliases the ParallelJobContainerBase.DefaultOutputLevel.
bool IsTestMode [get, set]
 Whether the current job data conntainer is in test mode. In this mode, delays specified by internal variables are automatically added in job execution.
int Id [get]
 Unique ID for objects of the currnet and derived classes.
static int DefaultSleepTimeMs [get, set]
 Default sleeping time, in milliseconds, used by parallel job data objects when waiting for fulfillment of some condition in a loop that includes sleeping when condition is not met.
int SleepTimeMs [get, set]
 Sleeping time, in milliseconds, used by the current object when waiting for fulfillment of some condition in a loop that includes sleeping when condition is not met. DefaultSleepTimeMs specifies the default value that is set when object is created.
int NumIdleJobServers [get]
 Gets the number of idle job servers that are currently available on the dispatcher.
int NumSentJobs [get]
 Gets the number of sent jobs (all jobs sent to the current dispatcher for execution).
int NumStartedJobs [get]
 Gets the number of jobs started by the dispatcher up to this point.
int NumFinishedJobs [get]
 Gets the number of finished jobs (of those handled by the current dispatcher) up to this point.
int NumAbortedJobs [get]
 Gets the number of aborted jobs (of those handled by the current dispatcher) up to this point.
int NumUncompletedJobs [get]
 Gets the number of idle job runners that are currently available on the dispatcher.

Private Attributes

readonly object _mainLock = new object()
int _id = GetNextId()
int _nextJobId = 0
int _numIdleJobServers = 0
int _numStartedJobs = 0
int _numFinishedJobs = 0
int _numAbortedJobs = 0

Static Private Attributes

static int _nextId = 0
static int _defaultSleepTimeMs = 2

Detailed Description

Base class for parallel job dispatchers. Accepts job requests and dispatches jobs to parallel job servers when available and redy to run a job.

Template Parameters:
DataContainerTypeType of the container that holds data for the job (input and output).

A non-generic class is defined in order to be used in the job data container class (ParallelJobContainerBase).

$A Igor Aug08;


Member Function Documentation

static int IG::Num::ParallelJobDispatcherBase::GetNextId ( ) [inline, static, protected]

Returns another ID that is unique for objects of the containing class its and derived classes.

internal int IG::Num::ParallelJobDispatcherBase::GetNextJobId ( ) [inline, protected]

Generates and returns a new Job Id that is unique in the scope of the current dispatcher.

void IG::Num::ParallelJobDispatcherBase::ResetNumIdleJobServers ( ) [inline, protected]

Resets number of idle job servers to 0.

internal void IG::Num::ParallelJobDispatcherBase::IncrementNumIdleJobServers ( ) [inline, protected]

Increments by one the number of idle job servers that are currently available on the dispatcher.

internal void IG::Num::ParallelJobDispatcherBase::DecrementNumIdleJobServers ( ) [inline, protected]

Decrements by one the number of idle job servers that are currently available on the dispatcher.

void IG::Num::ParallelJobDispatcherBase::IncrementNumSentJobs ( ) [inline]

Increments by one the number of sent jobs (all jobs sent to the current dispatcher for execution).

void IG::Num::ParallelJobDispatcherBase::IncrementNumStartedJobs ( ) [inline]

Increments by one the number of started by the dispatcher up to this point.

void IG::Num::ParallelJobDispatcherBase::IncrementNumFinishedJobs ( ) [inline]

Increments by one the number of finished jobs (of those handled by the current dispatcher) up to this point.

void IG::Num::ParallelJobDispatcherBase::IncrementNumAbortedJobs ( ) [inline]

Increments by one the number of aborted jobs (of those handled by the current dispatcher) up to this point.


Member Data Documentation

readonly object IG::Num::ParallelJobDispatcherBase::_mainLock = new object() [private]
readonly object IG::Num::ParallelJobDispatcherBase::ServersLock = new object() [protected]

Lock that is usef for locking code that can be run from servers. List of idle servers is locked by this lock, as well as various data that is accessed on job start, abort or finished events on servers, such as number of started jobs.

Output level for objects of this class. Specifies how much output is printed to console during operation.

int IG::Num::ParallelJobDispatcherBase::_id = GetNextId() [private]
int IG::Num::ParallelJobDispatcherBase::_sleepTimeMs = DefaultSleepTimeMs [protected]

Property Documentation

object IG::Num::ParallelJobDispatcherBase::Lock [get]

This object's central lock object to be used by other object. Do not use this object for locking in class' methods, for this you should use InternalLock.

Implements IG::Lib::ILockable.

int IG::Num::ParallelJobDispatcherBase::DefaultOutputLevel [static, get, set]

Default output level for objects of this and derived types. Just aliases the ParallelJobContainerBase.DefaultOutputLevel.

int IG::Num::ParallelJobDispatcherBase::OutputLevel [get, set]

Output level the current object. Specifies how much output is printed to console during operation.

bool IG::Num::ParallelJobDispatcherBase::DefaultIsTestMode [static, get, set]

Default value of test mode flag. Just aliases the ParallelJobContainerBase.DefaultOutputLevel.

bool IG::Num::ParallelJobDispatcherBase::IsTestMode [get, set]

Whether the current job data conntainer is in test mode. In this mode, delays specified by internal variables are automatically added in job execution.

int IG::Num::ParallelJobDispatcherBase::Id [get]

Unique ID for objects of the currnet and derived classes.

Implements IG::Lib::IIdentifiable.

int IG::Num::ParallelJobDispatcherBase::DefaultSleepTimeMs [static, get, set]

Default sleeping time, in milliseconds, used by parallel job data objects when waiting for fulfillment of some condition in a loop that includes sleeping when condition is not met.

int IG::Num::ParallelJobDispatcherBase::SleepTimeMs [get, set]

Sleeping time, in milliseconds, used by the current object when waiting for fulfillment of some condition in a loop that includes sleeping when condition is not met. DefaultSleepTimeMs specifies the default value that is set when object is created.

int IG::Num::ParallelJobDispatcherBase::NumIdleJobServers [get]

Gets the number of idle job servers that are currently available on the dispatcher.

int IG::Num::ParallelJobDispatcherBase::NumSentJobs [get]

Gets the number of sent jobs (all jobs sent to the current dispatcher for execution).

int IG::Num::ParallelJobDispatcherBase::NumStartedJobs [get]

Gets the number of jobs started by the dispatcher up to this point.

int IG::Num::ParallelJobDispatcherBase::NumFinishedJobs [get]

Gets the number of finished jobs (of those handled by the current dispatcher) up to this point.

int IG::Num::ParallelJobDispatcherBase::NumAbortedJobs [get]

Gets the number of aborted jobs (of those handled by the current dispatcher) up to this point.

int IG::Num::ParallelJobDispatcherBase::NumUncompletedJobs [get]

Gets the number of idle job runners that are currently available on the dispatcher.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties Events