Game Development Reference
In-Depth Information
Earlier, workflow management was discussed as a common application for job
scheduling, but this chapter is meant to focus on the technology behind the sched-
uling itself, not business process or workflow. Near the end of the chapter, some
goals are discussed that would be applicable to a scheduling system that managed
workflow.
The solution must also ensure that data is efficiently processed in a generic man-
ner. Each job performs a different role, but the core functionality remains the
same. The framework must provide a mechanism to pass arbitrary data through a
job efficiently.
Two job scheduling modes are available: exact and time span. The exact mode
specifies a specific date and time that a job will be executed. The job will fire once
and then be promptly removed from the scheduler. The time span mode specifies
an interval at which a job will be executed on a recurring basis.
Implementation
The namespaces used in the implementation are very simple, shown with the fol-
lowing code. Be sure to reference System.Timers so that you have access to the .NET
Timer object.
using System;
using System.Timers;
As outlined in the solution goals, the core framework will support two different
scheduling modes. The following enumeration will be used within the job and
scheduler components to distinguish between the two modes.
public enum ScheduleMode
{
Exact,
Span
}
The following class implements the event arguments that are passed in the event
handler when a job is executed.
public class JobTriggeredEventArgs : EventArgs
{
private ScheduleMode _mode;
private Object _userData;
Search Nedrilad ::




Custom Search