Use of. Net quartz Program

Source: Internet
Author: User
Tags log4net
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 ~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.