Job Class
Assembly: PTS.Workers.dll
Syntax
public abstract class Job : IJob
Inheritance
System.Object
Job
Constructors
Job()
Declaration
Job(Interval)
Declaration
public Job(Interval interval)
Parameters
Type |
Name |
Description |
Interval |
interval |
The interval.
|
Job(Boolean)
Declaration
Parameters
Type |
Name |
Description |
System.Boolean |
runOnce |
|
Job(Int32)
Declaration
public Job(int intervalMs)
Parameters
Type |
Name |
Description |
System.Int32 |
intervalMs |
|
Properties
CurrentCycleStartedAt
Gets the Date/Time when current work cycle started.
Declaration
public virtual DateTime? CurrentCycleStartedAt { get; }
Property Value
Type |
Description |
System.Nullable<System.DateTime> |
|
Declaration
public virtual bool ImmediateStart { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
Interrupt
Gets or sets a value indicating whether the interrupt.
Declaration
protected virtual bool Interrupt { get; set; }
Property Value
Type |
Description |
System.Boolean |
true if interrupt, false if not.
|
Interval
Gets or sets the task cycle interval in milliseconds.
Declaration
public virtual int Interval { get; set; }
Property Value
Type |
Description |
System.Int32 |
The interval.
|
InvokeCount
Gets or sets the number of task cycles.
Declaration
protected virtual ulong InvokeCount { get; }
Property Value
Type |
Description |
System.UInt64 |
The number of invokes.
|
IsDebugging
Declaration
protected bool IsDebugging { get; }
Property Value
Type |
Description |
System.Boolean |
|
LastCycleEndedAt
Gets the Date/Time when the previousW work cycle finished.
Declaration
public virtual DateTime? LastCycleEndedAt { get; }
Property Value
Type |
Description |
System.Nullable<System.DateTime> |
|
LastCycleStartedAt
Gets the Date/Time when the previousW work cycle started.
Declaration
public virtual DateTime? LastCycleStartedAt { get; }
Property Value
Type |
Description |
System.Nullable<System.DateTime> |
|
LogBlackList
Declaration
public static ConcurrentHashSet<NoticeType> LogBlackList { get; }
Property Value
Name
Declaration
public string Name { get; }
Property Value
Type |
Description |
System.String |
|
RunOnce
Declaration
public virtual bool RunOnce { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
StartAt
Declaration
public virtual Time? StartAt { get; set; }
Property Value
Type |
Description |
System.Nullable<Time> |
|
StartedAt
Gets the Date/Time when the task was started.
Declaration
public virtual DateTime StartedAt { get; }
Property Value
Type |
Description |
System.DateTime |
|
TaskId
Gets or sets the identifier of the task.
Declaration
public virtual string TaskId { get; }
Property Value
Type |
Description |
System.String |
The identifier of the task.
|
Timing
Declaration
public virtual JobTiming Timing { get; set; }
Property Value
Methods
AfterWork()
Gets called from ThreadLoop method right after the task cycle is executed in DoWork method
Declaration
protected virtual void AfterWork()
BeforeWork()
Gets called from ThreadLoop method right before the task cycle is executed in DoWork method
Declaration
protected virtual void BeforeWork()
DoWork()
Executes the work operation.
Declaration
protected abstract void DoWork()
GetPreciseWaitPeriod()
Declaration
protected virtual TimeSpan GetPreciseWaitPeriod()
Returns
Type |
Description |
System.TimeSpan |
|
Initialize()
Declaration
protected void Initialize()
Log(Exception, NoticeType)
Declaration
protected void Log(Exception ex, NoticeType type = NoticeType.Error)
Parameters
Type |
Name |
Description |
System.Exception |
ex |
|
NoticeType |
type |
|
Log(String, NoticeType)
Declaration
protected void Log(string message, NoticeType type = NoticeType.Info)
Parameters
Type |
Name |
Description |
System.String |
message |
|
NoticeType |
type |
|
Make(Type)
Declaration
public static Job Make(Type taskType)
Parameters
Type |
Name |
Description |
System.Type |
taskType |
|
Returns
Make<TTask>()
Declaration
public static TTask Make<TTask>()
where TTask : Job, new()
Returns
Type Parameters
Make<TTask>(Interval, Time)
Declaration
public static TTask Make<TTask>(Interval interval, Time startAt)
where TTask : Job, new()
Parameters
Returns
Type Parameters
Make<TTask>(Interval, Boolean)
Declaration
public static TTask Make<TTask>(Interval interval, bool immediateStart = false)
where TTask : Job, new()
Parameters
Type |
Name |
Description |
Interval |
interval |
|
System.Boolean |
immediateStart |
|
Returns
Type Parameters
OnJobStarted()
Declaration
protected virtual void OnJobStarted()
OnTaskStopped()
Declaration
protected virtual void OnTaskStopped()
Start()
Declaration
public virtual void Start()
Stop()
Declaration
public virtual void Stop()
ThreadLoop()
Runs infinite loop for with appropriate delay for each cycle under dedicated thread.
Declaration
protected void ThreadLoop()
WorkCycle()
Declaration
protected virtual void WorkCycle()
Implements
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Extension Methods