IGLib  1.5
The IGLib base library for development of numerical, technical and business applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
IG.Num.ParallelJobServerGen< InputType, ResultType, JobContainerType > Class Template Reference

Parallel job server for job containers that inherit from ParallelJobContainerGen. More...

+ Inheritance diagram for IG.Num.ParallelJobServerGen< InputType, ResultType, JobContainerType >:
+ Collaboration diagram for IG.Num.ParallelJobServerGen< InputType, ResultType, JobContainerType >:

Public Member Functions

 ParallelJobServerGen ()
 
- Public Member Functions inherited from IG.Num.ParallelJobServerBase< JobContainerType >
 ParallelJobServerBase ()
 
void NotifyJobStarted ()
 Notifies all interested objects that the job has started. More...
 
void NotifyJobFinished ()
 Notifies all interested objects that the job has finished. More...
 
void NotifyJobAborted ()
 Notifies all interested parties that job has been aborted. More...
 
void NotifyServerIdle (ParallelJobDispatcherBase< JobContainerType > dispatcher)
 Sets the Idle flag to true and notifies the containing dispatcher that the current server object has became idle. More...
 
void StopServerThread ()
 Sends to the server thread command that it has to stop. More...
 
void KillServerThread ()
 Forces the working to stop, even if it is in the middle of eecution of a job, by aborting the thread. To let the working thread finish its current jobs and then stop, call StopServerThread More...
 
void StartServer ()
 
void StartJobByServer ()
 Starts job by the server. More...
 
void StartSingleJob ()
 Starts a single job in a new therad taht is created for this purpose. More...
 
void RunJobSynchronous (JobContainerType jobData)
 
void StartJob (JobContainerType jobData)
 Starts the current job in the way specified by internal flags. More...
 
override string ToString ()
 Returns a string representation of the current job server, which contains relevent data about the server state. More...
 

Protected Member Functions

override void RunJobDefined (JobContainerType jobData)
 Runs the job whose data is contained in the specified job data container. More...
 
- Protected Member Functions inherited from IG.Num.ParallelJobServerBase< JobContainerType >
void NotifyServerAboutJob ()
 
void Serve ()
 
void RunSingleJobInThread ()
 Methods that runs the job on the serving thread, for the case when a new thread is allocated for each job (single job per thread). More...
 
void RunJobInThread ()
 Methods that runs the job on the serving thread, for the case when server thread executes multiple jobs (server mode). More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from IG.Num.ParallelJobServerBase< JobContainerType >
static int GetNextId ()
 Returns another ID that is unique for objects of the containing class its and derived classes. More...
 
- Protected Attributes inherited from IG.Num.ParallelJobServerBase< JobContainerType >
volatile bool _isTestMode = ParallelJobContainerBase.DefaultIsTestMode
 
int _sleepTimeMs = DefaultSleepTimeMs
 
ParallelJobDispatcherBase
< JobContainerType > 
_dispatcher
 
ParallelServerState _state = ParallelServerState.Idle
 
JobContainerType _jobData
 
bool _isServer = false
 
bool _commandStopServing = false
 
ThreadPriority _threadPriority = UtilSystem.ThreadPriority
 
Thread _workingThread
 
bool _isServerRunning = false
 
- Properties inherited from IG.Num.ParallelJobServerBase< JobContainerType >
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. More...
 
static int DefaultOutputLevel [get, set]
 Default output level for objects of this and derived types. More...
 
int OutputLevel [get, set]
 Output level the current object. More...
 
static bool DefaultIsTestMode [get, set]
 Default value of test mode flag. More...
 
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. More...
 
int Id [get]
 Unique ID for objects of the currnet and derived classes. More...
 
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. More...
 
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. More...
 
ParallelJobDispatcherBase
< JobContainerType > 
Dispatcher [get, set]
 
ParallelServerState State [get, protected set]
 Gets the state of the current job runner. More...
 
bool IsIdle [get]
 Gets a flag indicating whether the current job runner is idle. More...
 
bool IsActive [get]
 
JobContainerType JobData [get, set]
 Data for the job that is executed by teh current parallel job runner. More...
 
bool IsServer [get, set]
 Indicating whether the current job runner work as server. <par>If true then a server is started in a parallel thread that continuously for signals to start jobs.</par> More...
 
bool CommandStopServing [get, protected set]
 Flag indicating whether the server should be stopped. If set to true and server thread is runing, then the server thread stops when the currently run job completes (or stops immediately if there is no job running). More...
 
ThreadPriority ThreadPriority [get, set]
 Priority of the server thread. More...
 
bool IsServerRunning [get]
 Indicates whether the server is currently running or not. More...
 
bool DoRunJobByServer [get, protected set]
 
- Properties inherited from IG.Lib.ILockable
object Lock [get]
 
- Properties inherited from IG.Lib.IIdentifiable
int Id [get]
 Returns unique ID (in the scope of a given type) of the current object. More...
 

Detailed Description

Parallel job server for job containers that inherit from ParallelJobContainerGen.

Template Parameters
InputTypeType of inpout data for jobs.
ResultTypeType of output data for jobs.
JobContainerTypeType of the job data container used by this parallel server class. It must be be of type ParallelJobContainer<InputType, ResultType>, or must derive form this type.
Type Constraints
JobContainerType :ParallelJobContainerGen 
JobContainerType :InputType 
JobContainerType :ResultType 

Constructor & Destructor Documentation

IG.Num.ParallelJobServerGen< InputType, ResultType, JobContainerType >.ParallelJobServerGen ( )
inline

Member Function Documentation

override void IG.Num.ParallelJobServerGen< InputType, ResultType, JobContainerType >.RunJobDefined ( JobContainerType  jobData)
inlineprotectedvirtual

Runs the job whose data is contained in the specified job data container.

Parameters
jobDataData container for the job to be run.

This method runs the job by runniing the ParallelJobContainer<InputType, ResultType>.RunJob method defined on the job container (argument jobData ).

Implements IG.Num.ParallelJobServerBase< JobContainerType >.


The documentation for this class was generated from the following file: