Public class maninfo {static log4net. ilog logger = log4net. logmanager. getlogger (typeof (infobll); public static void start () {ischedulerfactory _ schedfactory = new stdschedulerfactory (); logger. info ("start executionProgram"); Try {// scheduled task isched1_sched = _ schedfactory. getscheduler (); jobschedulingdataprocessor processor = new jobschedulingdataprocessor (True, true); stream S = new filestream (appdomain. currentdomain. basedirectory + (@ "macher-setting.xml"), filemode. open); processor. processstream (S, null); processor. schedulejobs (New hashtable (), sched, false); sched. start ();} catch (exception ex) {logger. error ("application_start:" + ex );}}}
Remember to reference quartz. dll
Public class infobll: ijob {static log4net. ilog logger = log4net. logmanager. getlogger (typeof (infobll); void ijob. execute (jobexecutioncontext context) {logger. info ("start changing information status"); import (); logger. info ("Starting To fix changes"); repair (); // system. threading. waitcallback = new waitcallback (bindwlt); // threadpool. queueuserworkitem (waitcallback, arr); // threadpool. queueuserworkitem (waitcallback, arr1 );}}
Remember to inherit the interface!
The most important configuration is:
<? XML version = "1.0" encoding = "UTF-8"?> <Quartz xmlns = "http://quartznet.sourceforge.net/JobSchedulingData" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" version = "1.0" Overwrite-existing-jobs = "true"> <job-Detail> <Name> timed Update Status </Name> <Group> timed update </group> <description> timed update product status type </description> <job-type> myinfo. infobll, myinfo </job-type> </job-Detail> <trigger> <cron> <Name> Scheduled Update Status </Name> <group> Scheduled Update </group> <job -Name> timed update </job-na Me> <job-group> regular update </job-group> <Cron-expression> 0*15 **? </Cron-expression> </cron> </trigger> </job> </quartz>
The configuration file is described in the next article! O (distinct _ distinct) O ~