.net Quartz程序的使用
时间:2011-01-23 来源:酷&酷
public class InfoBLL : IJob { static log4net.ILog logger = log4net.LogManager.GetLogger(typeof(InfoBLL)); void IJob.Execute(JobExecutionContext context) { logger.Info("开始更改信息状态"); Import(); logger.Info("开始修复更改出现的信息"); repair(); // System.Threading.WaitCallback waitCallback = new WaitCallback(BindWLT); //ThreadPool.QueueUserWorkItem(waitCallback, arr); //ThreadPool.QueueUserWorkItem(waitCallback, arr1); } }记得一定要继承接口!
最重要的要配置:
<?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> <job-detail> <name>定时更新状态</name> <group>定时更新</group> <description>定时更新产品的状态类型</description> <job-type>MyInfo.InfoBLL,MyInfo</job-type> </job-detail> <trigger> <cron> <name>定时更新状态</name> <group>定时更新</group> <job-name>定时更新</job-name> <job-group>定时更新</job-group> <cron-expression> 0 * 15 * * ? </cron-expression> </cron> </trigger> </job> </quartz>配置文件说明见下一篇!O(∩_∩)O~
相关阅读 更多 +