所有方法图

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详解的更多相关文章

  1. SpringBoot系列(十二)过滤器配置详解

    SpringBoot(十二)过滤器详解 往期精彩推荐 SpringBoot系列(一)idea新建Springboot项目 SpringBoot系列(二)入门知识 springBoot系列(三)配置文件 ...

  2. 深入浅出Mybatis系列(四)---配置详解之typeAliases别名(mybatis源码篇)

    上篇文章<深入浅出Mybatis系列(三)---配置详解之properties与environments(mybatis源码篇)> 介绍了properties与environments, ...

  3. Android Studio系列教程五--Gradle命令详解与导入第三方包

    Android Studio系列教程五--Gradle命令详解与导入第三方包 2015 年 01 月 05 日 DevTools 本文为个人原创,欢迎转载,但请务必在明显位置注明出处!http://s ...

  4. 构建安全的Xml Web Service系列之wse之错误代码详解

    原文:构建安全的Xml Web Service系列之wse之错误代码详解 WSE3.0现在还没有中文版的可以下载,使用英文版的过程中,难免会遇到各种各样的错误,而面对一堆毫无头绪的错误异常,常常会感到 ...

  5. [js高手之路] es6系列教程 - 对象功能扩展详解

    第一:字面量对象的方法,支持缩写形式 //es6之前,这么写 var User = { name : 'ghostwu', showName : function(){ return this.nam ...

  6. ST MCU_GPIO的八种工作模式详解。

    补充: N.P型的区别,就是一个为正电压启动(NMOS),一个为负电压启动(PMOS) GPIO的八种工作模式详解 浮空输入_IN_FLOATING带上拉输入_IPU带下拉输入_IPD模拟输入_AIN ...

  7. [转帖]Linux系列之SAR命令使用详解

    Linux系列之SAR命令使用详解 sar是System Activity Reporter(系统活动情况报告)的缩写.这个工具所需要的负载很小,也是目前linux中最为全面的性能分析工具之一.此款工 ...

  8. Velocity魔法堂系列二:VTL语法详解

    一.前言 Velocity作为历史悠久的模板引擎不单单可以替代JSP作为Java Web的服务端网页模板引擎,而且可以作为普通文本的模板引擎来增强服务端程序文本处理能力.而且Velocity被移植到不 ...

  9. quartz (从原理到应用)详解篇(转)

    一.Quartz 基本介绍 1.1 Quartz 概述 1.2 Quartz特点 1.3 Quartz 集群配置 二.Quartz 原理及流程 2.1 quartz基本原理 2.2 quartz启动流 ...

  10. 实时通讯系列目录篇之SignalR详解

    一. 简单说几句 最早使用SignalR的时候大约是两年前了,记得当时是一个OA中消息的实时提醒,轮询的方式有点耗资源,WebSocket写起来又比较麻烦,最终选择了SignalR,当时是什么版本已经 ...

随机推荐

  1. Rust WebAssembly 绑定输入类型(基于 Serde)

    前言 单位有个项目要共享前后端检查策略后端用的正好也是 Rust,但是 Rust 默认的 wasm-bindgen 包中提供的转换操作非常少,像 Vec<T> <=> Arra ...

  2. oracle 命令4 热备份

    热备份:不停数据库,一定范围内(内存写满后,用户操作挂起),不影响用户使用.数据库开着,时刻变化,因此热备份通过以下手段保持一致性:1.开启归档2.备份前,通知数据库,把文件锁定,在备份未完成前,不操 ...

  3. 手撕Vue-编译指令数据

    经过上一篇的分析,完成了查找指令和模板的功能,接下来就是编译指令的数据了. 所以本章节主要处理的方法则是 buildElement 方法,我们先分析一下我们所拿到的数据在进行编码,这样会更加清晰一些. ...

  4. Newstar CTF 2023

    WEEK1 PWN 1.ezshellcode 直接sendline(shellcode)即可 exp: from pwn import * p = remote("node4.buuoj. ...

  5. Vue之监听数据变化

    1.轻度监视 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UT ...

  6. 虹科干货| 虹科Redis企业版数据库:告别游戏卡顿,让快乐加速!

    "卡顿一分钟,玩家两行泪" 游戏已成为年轻人最主要的消遣娱乐方式之一,游戏卡顿给玩家带来糟糕游戏体验背后的原因是什么?数据存储与查询速度不够快!   游戏开发领域,不仅拥有海量的数 ...

  7. camerabin error:"Internal data stream error,使用QT打开MIPI摄像头

    使用QT自带的QCamera打开MIPI摄像头 遇到:camerabin error:"Internal data stream error 降低分辨率为640*480 TRANSLATE ...

  8. PTA乙级1099

    #include"bits/stdc++.h" using namespace std; int prime(int x) { if(x<2) return 0; for(i ...

  9. Kubernetes: kube-apiserver 之认证

    kubernetes:kube-apiserver 系列文章: Kubernetes:kube-apiserver 之 scheme(一) Kubernetes:kube-apiserver 之 sc ...

  10. 轻松一刻|Walrus CLI与CI/CD工具集成,轻松部署2048游戏

    Walrus 是一款开源的基于平台工程理念.以应用为中心.以完整应用系统自动化编排交付为目标进行设计开发的云原生应用平台,简化和自动化应用部署与发布流程并与现有的 CI/CD 流水线无缝集成.今天我们 ...