Quartz.Net系列(八):Trigger之CalendarIntervalScheduleBuilder详解
所有方法图

CalendarIntervalScheduleBuilder方法
在SimpleScheduleBuilder基础上实现了日、周、月、年
WithInterval:指定要生成触发器的时间单位和间隔。
WithIntervalInHours:指定要生成触发器的间隔按小时来
WithIntervalInMinutes:指定要生成触发器的间隔按分钟来
WithIntervalInSeconds:指定要生成触发器的间隔按秒来
WithIntervalInDays:指定要生成触发器的间隔按日来
WithIntervalInWeeks:指定要生成触发器的间隔按周来
WithIntervalInMonths:指定要生成触发器的间隔按月来
WithIntervalInYears:指定要生成触发器的间隔按年来
var trigger = TriggerBuilder.Create().WithCalendarIntervalSchedule(c=>c .WithInterval(1, IntervalUnit.Millisecond)
.WithIntervalInSeconds(1)
.WithIntervalInMinutes(1)
.WithIntervalInHours(1)
.WithIntervalInDays(1)
.WithIntervalInWeeks(1)
.WithIntervalInMonths(1)
.WithIntervalInYears(1)).Build();
注:按最后一个设定时间为准
最后指定给字段interval和intervalUnit,那么前面就会覆盖
在不指定间隔的时候默认是1,间隔单位是一天
public class CalendarIntervalScheduleBuilder : ScheduleBuilder<ICalendarIntervalTrigger>
{
private int interval = 1;
private IntervalUnit intervalUnit = IntervalUnit.Day; private int misfireInstruction = MisfireInstruction.SmartPolicy;
private TimeZoneInfo timeZone;
private bool preserveHourOfDayAcrossDaylightSavings;
private bool skipDayIfHourDoesNotExist;
}

/// <summary>
/// Supported interval units used by <see cref="ICalendarIntervalTrigger" />.
/// </summary>
public enum IntervalUnit
{
Millisecond,
Second,
Minute,
Hour,
Day,
Week,
Month,
Year
}
/// <summary>
/// Specify the time unit and interval for the Trigger to be produced.
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="interval">the interval at which the trigger should repeat.</param>
/// <param name="unit"> the time unit (IntervalUnit) of the interval.</param>
/// <returns>the updated CalendarIntervalScheduleBuilder</returns>
/// <seealso cref="ICalendarIntervalTrigger.RepeatInterval" />
/// <seealso cref="ICalendarIntervalTrigger.RepeatIntervalUnit" />
public CalendarIntervalScheduleBuilder WithInterval(int interval, IntervalUnit unit)
{
ValidateInterval(interval);
this.interval = interval;
intervalUnit = unit;
return this;
} /// <summary>
/// Specify an interval in the IntervalUnit.SECOND that the produced
/// Trigger will repeat at.
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="intervalInSeconds">the number of seconds at which the trigger should repeat.</param>
/// <returns>the updated CalendarIntervalScheduleBuilder</returns>
/// <seealso cref="ICalendarIntervalTrigger.RepeatInterval" />
/// <seealso cref="ICalendarIntervalTrigger.RepeatIntervalUnit" />
public CalendarIntervalScheduleBuilder WithIntervalInSeconds(int intervalInSeconds)
{
ValidateInterval(intervalInSeconds);
interval = intervalInSeconds;
intervalUnit = IntervalUnit.Second;
return this;
} /// <summary>
/// Specify an interval in the IntervalUnit.MINUTE that the produced
/// Trigger will repeat at.
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="intervalInMinutes">the number of minutes at which the trigger should repeat.</param>
/// <returns>the updated CalendarIntervalScheduleBuilder</returns>
/// <seealso cref="ICalendarIntervalTrigger.RepeatInterval" />
/// <seealso cref="ICalendarIntervalTrigger.RepeatIntervalUnit" />
public CalendarIntervalScheduleBuilder WithIntervalInMinutes(int intervalInMinutes)
{
ValidateInterval(intervalInMinutes);
interval = intervalInMinutes;
intervalUnit = IntervalUnit.Minute;
return this;
} /// <summary>
/// Specify an interval in the IntervalUnit.HOUR that the produced
/// Trigger will repeat at.
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="intervalInHours">the number of hours at which the trigger should repeat.</param>
/// <returns>the updated CalendarIntervalScheduleBuilder</returns>
/// <seealso cref="ICalendarIntervalTrigger.RepeatInterval" />
/// <seealso cref="ICalendarIntervalTrigger.RepeatIntervalUnit" />
public CalendarIntervalScheduleBuilder WithIntervalInHours(int intervalInHours)
{
ValidateInterval(intervalInHours);
interval = intervalInHours;
intervalUnit = IntervalUnit.Hour;
return this;
} /// <summary>
/// Specify an interval in the IntervalUnit.DAY that the produced
/// Trigger will repeat at.
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="intervalInDays">the number of days at which the trigger should repeat.</param>
/// <returns>the updated CalendarIntervalScheduleBuilder</returns>
/// <seealso cref="ICalendarIntervalTrigger.RepeatInterval" />
/// <seealso cref="ICalendarIntervalTrigger.RepeatIntervalUnit" />
public CalendarIntervalScheduleBuilder WithIntervalInDays(int intervalInDays)
{
ValidateInterval(intervalInDays);
interval = intervalInDays;
intervalUnit = IntervalUnit.Day;
return this;
} /// <summary>
/// Specify an interval in the IntervalUnit.WEEK that the produced
/// Trigger will repeat at.
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="intervalInWeeks">the number of weeks at which the trigger should repeat.</param>
/// <returns>the updated CalendarIntervalScheduleBuilder</returns>
/// <seealso cref="ICalendarIntervalTrigger.RepeatInterval" />
/// <seealso cref="ICalendarIntervalTrigger.RepeatIntervalUnit" />
public CalendarIntervalScheduleBuilder WithIntervalInWeeks(int intervalInWeeks)
{
ValidateInterval(intervalInWeeks);
interval = intervalInWeeks;
intervalUnit = IntervalUnit.Week;
return this;
} /// <summary>
/// Specify an interval in the IntervalUnit.MONTH that the produced
/// Trigger will repeat at.
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="intervalInMonths">the number of months at which the trigger should repeat.</param>
/// <returns>the updated CalendarIntervalScheduleBuilder</returns>
/// <seealso cref="ICalendarIntervalTrigger.RepeatInterval" />
/// <seealso cref="ICalendarIntervalTrigger.RepeatIntervalUnit" />
public CalendarIntervalScheduleBuilder WithIntervalInMonths(int intervalInMonths)
{
ValidateInterval(intervalInMonths);
interval = intervalInMonths;
intervalUnit = IntervalUnit.Month;
return this;
} /// <summary>
/// Specify an interval in the IntervalUnit.YEAR that the produced
/// Trigger will repeat at.
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="intervalInYears">the number of years at which the trigger should repeat.</param>
/// <returns>the updated CalendarIntervalScheduleBuilder</returns>
/// <seealso cref="ICalendarIntervalTrigger.RepeatInterval" />
/// <seealso cref="ICalendarIntervalTrigger.RepeatIntervalUnit" />
public CalendarIntervalScheduleBuilder WithIntervalInYears(int intervalInYears)
{
ValidateInterval(intervalInYears);
interval = intervalInYears;
intervalUnit = IntervalUnit.Year;
return this;
}
InTimeZone:设置时区
var trigger = TriggerBuilder.Create().WithCalendarIntervalSchedule(c => c.InTimeZone(TimeZoneInfo.Local)).Build();
Quartz.Net系列(八):Trigger之CalendarIntervalScheduleBuilder详解的更多相关文章
- SpringBoot系列(十二)过滤器配置详解
SpringBoot(十二)过滤器详解 往期精彩推荐 SpringBoot系列(一)idea新建Springboot项目 SpringBoot系列(二)入门知识 springBoot系列(三)配置文件 ...
- 深入浅出Mybatis系列(四)---配置详解之typeAliases别名(mybatis源码篇)
上篇文章<深入浅出Mybatis系列(三)---配置详解之properties与environments(mybatis源码篇)> 介绍了properties与environments, ...
- Android Studio系列教程五--Gradle命令详解与导入第三方包
Android Studio系列教程五--Gradle命令详解与导入第三方包 2015 年 01 月 05 日 DevTools 本文为个人原创,欢迎转载,但请务必在明显位置注明出处!http://s ...
- 构建安全的Xml Web Service系列之wse之错误代码详解
原文:构建安全的Xml Web Service系列之wse之错误代码详解 WSE3.0现在还没有中文版的可以下载,使用英文版的过程中,难免会遇到各种各样的错误,而面对一堆毫无头绪的错误异常,常常会感到 ...
- [js高手之路] es6系列教程 - 对象功能扩展详解
第一:字面量对象的方法,支持缩写形式 //es6之前,这么写 var User = { name : 'ghostwu', showName : function(){ return this.nam ...
- ST MCU_GPIO的八种工作模式详解。
补充: N.P型的区别,就是一个为正电压启动(NMOS),一个为负电压启动(PMOS) GPIO的八种工作模式详解 浮空输入_IN_FLOATING带上拉输入_IPU带下拉输入_IPD模拟输入_AIN ...
- [转帖]Linux系列之SAR命令使用详解
Linux系列之SAR命令使用详解 sar是System Activity Reporter(系统活动情况报告)的缩写.这个工具所需要的负载很小,也是目前linux中最为全面的性能分析工具之一.此款工 ...
- Velocity魔法堂系列二:VTL语法详解
一.前言 Velocity作为历史悠久的模板引擎不单单可以替代JSP作为Java Web的服务端网页模板引擎,而且可以作为普通文本的模板引擎来增强服务端程序文本处理能力.而且Velocity被移植到不 ...
- quartz (从原理到应用)详解篇(转)
一.Quartz 基本介绍 1.1 Quartz 概述 1.2 Quartz特点 1.3 Quartz 集群配置 二.Quartz 原理及流程 2.1 quartz基本原理 2.2 quartz启动流 ...
- 实时通讯系列目录篇之SignalR详解
一. 简单说几句 最早使用SignalR的时候大约是两年前了,记得当时是一个OA中消息的实时提醒,轮询的方式有点耗资源,WebSocket写起来又比较麻烦,最终选择了SignalR,当时是什么版本已经 ...
随机推荐
- Robert Kiraly Software Developer
Robert KiralySoftware DeveloperCell Phone: 650-600-2520 Freenode: ##venturesSupports text messages P ...
- 手敲,Ascend算子开发入门笔记分享
本文分享自华为云社区<Ascend算子开发入门笔记>,作者: JeffDing . 基础概念 什么是Ascend C Ascend C是CANN针对算子开发场景推出的编程语言,原生支持C和 ...
- React跨路由组件动画
我们是袋鼠云数栈 UED 团队,致力于打造优秀的一站式数据中台产品.我们始终保持工匠精神,探索前端道路,为社区积累并传播经验价值. 本文作者:佳岚 回顾传统React动画 对于普通的 React 动画 ...
- My Code Style
大家都在写,跟风. 头文件 万能头.因为我刚学 OI 的时候怎么都背不住 algorithm 怎么拼( 变量 数组开全局,一些前后重名/只在某一部分用的变量开局部. 尽量不使用指针/ stl 迭代器等 ...
- Apache Hudi Timeline:支持 ACID 事务的基础
Apache Hudi 维护在给定表上执行的所有操作的Timeline(时间线),以支持以符合 ACID 的方式高效检索读取查询的数据. 在写入和表服务期间也会不断查阅时间线,这是表正常运行的关键. ...
- C#12中的Primary Constructors(主构造函数)
什么是主构造函数 把参数添加到class与record的类声明中就是主构造函数.例如 class Person(string name) { private string _name = name; ...
- iOS之H5与原生交互
少年易学老难成,一寸光阴不可轻. 1. 利用UIWebView交互 iOS7之前通过UIWebView相关代理方法进行通信.原理:通过协议拦截实现h5对原生的调用,通过直接调用js来实现原生对h5 ...
- mac端 安卓UI自动化安装环境配置
安装JDK 官网下载安装包https://www.oracle.com/java/technologies/javase/javase8u211-later-archive-downloads.h ...
- Alist手动安装并使用教程
一.官方文档及下载地址 1.官方文档 AList文档 2.下载地址 alist · GitHub 二.下载并解压文件 以Windows为例,下载指定版本的文件. 三.运行 1.解压文件并进入文件夹: ...
- AtCoder_abc329
AtCoder_abc329 比赛链接 A - Spread A题链接 题目大意 输入一个字符串由大写字母组成的\(S\),输出\(S\)并在每一个字符之间加上空格 解题思路 随便打打就能过.jpg ...