博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Quartz.NET 2.0 学习笔记(2) :和1.0的几点不同
阅读量:4992 次
发布时间:2019-06-12

本文共 6858 字,大约阅读时间需要 22 分钟。

Quartz.NET 2.0 2012年4月9日发布了Released

Quartz.NET 项目地址 

日常开发来说,相对于1.0版,2.0版在使用上有以下几点需要注意的变化

变化一 比1.0多引用了C5.dll

  • C5.dll 一个C#和其他CLI语言的泛型集合类。.Net2.0及以上才可以使用。简介地址:http://www.itu.dk/research/c5/

变化二 quartz.config有细微变化

  • quartz.plugin.xml.type由1.x的Quartz.Plugin.Xml.JobInitializationPlugin, Quartz变为了2.0中的Quartz.Plugin.Xml.XMLSchedulingDataProcessorPlugin, Quartz
  • 2.0版本新增了一行配置quartz.scheduler.exporter.channelName = httpQuart
  • 1.0 quartz.config
    1 # You can configure your scheduler in either 
    configuration section 2 # or in quartz properties file 3 # Configuration section has precedence 4 5 quartz.scheduler.instanceName = ServerScheduler 6 7 # configure thread pool info 8 quartz.threadPool.type = Quartz.Simpl.SimpleThreadPool, Quartz 9 quartz.threadPool.threadCount = 1010 quartz.threadPool.threadPriority = Normal11 12 # job initialization plugin handles our xml reading, without it defaults are used -->13 quartz.plugin.xml.type = Quartz.Plugin.Xml.JobInitializationPlugin, Quartz14 quartz.plugin.xml.fileNames = ~/quartz_jobs.xml15 16 # export this server to remoting context17 quartz.scheduler.exporter.type = Quartz.Simpl.RemotingSchedulerExporter, Quartz18 quartz.scheduler.exporter.port = 55519 quartz.scheduler.exporter.bindName = QuartzScheduler20 quartz.scheduler.exporter.channelType = tcp
  •  2.0 quartz.config
    1 # You can configure your scheduler in either 
    configuration section 2 # or in quartz properties file 3 # Configuration section has precedence 4 5 quartz.scheduler.instanceName = ServerScheduler 6 7 # configure thread pool info 8 quartz.threadPool.type = Quartz.Simpl.SimpleThreadPool, Quartz 9 quartz.threadPool.threadCount = 1010 quartz.threadPool.threadPriority = Normal11 12 # job initialization plugin handles our xml reading, without it defaults are used13 quartz.plugin.xml.type = Quartz.Plugin.Xml.XMLSchedulingDataProcessorPlugin, Quartz14 quartz.plugin.xml.fileNames = ~/quartz_jobs.xml15 16 # export this server to remoting context17 quartz.scheduler.exporter.type = Quartz.Simpl.RemotingSchedulerExporter, Quartz18 quartz.scheduler.exporter.port = 55519 quartz.scheduler.exporter.bindName = QuartzScheduler20 quartz.scheduler.exporter.channelType = tcp21 quartz.scheduler.exporter.channelName = httpQuartz

     

变化三 实现IJob接口 JobExecutionContext对象变成了IJobExecutionContext 

  • 1.0 IJob接口  
    public class SimpleJob : IJob    {        #region IJob 成员        public void Execute(JobExecutionContext context)        {            throw new NotImplementedException();        }        #endregion    }

     

  • 2.0 IJob接口
    public class SimpleJob : IJob    {        #region IJob 成员        public void Execute(IJobExecutionContext context)        {            throw new NotImplementedException();        }        #endregion    }

     

 

变化四 quartz_jobs.xml配置节发生了变化

  • 根结点有<quartz>变为了<job-scheduling-data>
  • 新增了<schedule>节点,<job>均放在<schedule>节点下,删除了 <job-detail>节点,同时删除了<volatile>false</volatile>属性
  • <trigger>不在放置在<job>下面,改为和<job>平行
  • 1.0 quartz_jobs.xml示例
    1 
    2
    3 4
    5
    6
    sampleJob
    7
    sampleGroup
    8
    Sample job for Quartz Server
    9
    Quartz.Job.NoOpJob, Quartz
    10
    false
    11
    true
    12
    false
    13
    14
    15
    16
    sampleSimpleTrigger
    17
    sampleSimpleGroup
    18
    Simple trigger to simply fire sample job
    19
    SmartPolicy
    20
    false
    21
    sampleJob
    22
    sampleGroup
    23
    RepeatIndefinitely
    24
    3000
    25
    26
    27
    28 29
    30
    31
    sampleJob2
    32
    sampleGroup2
    33
    Sample job for Quartz Server
    34
    Quartz.Job.NoOpJob, Quartz
    35
    false
    36
    true
    37
    false
    38
    39
    40
    41
    sampleSimpleTrigger2
    42
    sampleSimpleTrigger2
    43
    sampleJob2
    44
    sampleGroup2
    45
    0/10 * * * * ?
    46
    47
    48
    49

     

  • 2.0 quartz_jobs.xml示例
    true
    sampleJob
    sampleGroup
    Sample job for Quartz Server
    Quartz.Server.SampleJob, Quartz.Server
    true
    false
    sampleSimpleTrigger
    sampleSimpleGroup
    Simple trigger to simply fire sample job
    sampleJob
    sampleGroup
    SmartPolicy
    -1
    10000
    CommissionJob
    CommissionJob
    Sample job for Quartz Server
    Settlement.Jobs.CommissionJob, Settlement.Jobs
    true
    false
    sampleSimpleTrigger2
    sampleSimpleTrigger2
    sampleJob2
    sampleGroup2
    0/10 * * * * ?

     

 变化五 支持.Net版本不同

  • Quartz 1.0可以支持.Net 1.1 和 .Net 2.0及以上版本 
  • Quartz 2.0仅支持.Net 3.5及以上版本,放弃了对.Net 1.1和.Net 2.0的支持

转载于:https://www.cnblogs.com/lzrabbit/archive/2012/04/14/2446596.html

你可能感兴趣的文章
浅析Java中的final关键字
查看>>
PHP批量删除
查看>>
Android Studio 提示gradle Plugin is too old
查看>>
Android Studio中搜索中文字符串
查看>>
PostgreSQL - 转义字符
查看>>
两步搞定一台电脑同时开启多个tomcat
查看>>
jQuery EasyUI弹出确认对话框(确认操作中.....)
查看>>
CentOS7 监控网络流量
查看>>
根据控件名称反射查找控件
查看>>
编写和执行C#代码的插件:CS-Script for Notepad++
查看>>
BZOJ3569: DZY Loves Chinese II(线性基构造)
查看>>
Android系统源码下载及使用(Android 14到19源码)
查看>>
绑定dropdownlist
查看>>
[LeetCode] Sudoku Solver
查看>>
实验四
查看>>
Python Day04
查看>>
Android新增API之AudioEffect中文API与应用实例
查看>>
颜色空间RGB与HSV(HSL)的转换
查看>>
swift 用协议实现代理传值功能
查看>>
深入懂得android view 生命周期
查看>>