- 浏览: 780170 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (386)
- Linux (36)
- Tomcat (6)
- windows (8)
- Apache (10)
- Java (25)
- jquery (7)
- Jquery 插件 (3)
- Oracle (5)
- Oracle SQL (68)
- Spring (15)
- 开发工具 (6)
- Struts (20)
- js (14)
- Project Code (2)
- Project Code Tomcat (1)
- libset (1)
- JSP (8)
- arithmetic (2)
- 浏览器 (1)
- extjs (3)
- 学习网站 (5)
- 生活情感 (0)
- 电话号码算法 (3)
- 快捷键 (1)
- 转载 (1)
- Dos命令 (2)
- services (1)
- Resources (1)
- 行业积累 (3)
- 项目积累 (3)
- Web (3)
- 文档 (1)
- JavaEE (2)
- JSF (3)
- http (3)
- JS窗口 (1)
- Html (4)
- Flex (1)
- 资讯 (2)
- 项目规范 (1)
- Struts s:property textarea中默认值用 (1)
- Quartz 2.0.2 (12)
- 1天有多少毫秒 (1)
- 专题 (1)
- intellij idea 10 CD-KEY (1)
- restlet (4)
- Mail (1)
- Excel (3)
- Menu (1)
- Big Data技术综述 (1)
- Quart 1 (1)
- nosql (1)
- linux远程 (1)
- jdk (5)
- wind7 (1)
- 虚拟人 (0)
- 虚拟机 (1)
- 终端 (1)
- Ubuntu (16)
- Myeclipse (2)
- Wmware (1)
- eclipse (2)
- css (2)
- csv (1)
- 开源 (1)
- plsql (2)
- cassandra (4)
- maven (1)
- hadoop (2)
- mysql (1)
- spring security (1)
- tools (1)
- jdbc (2)
- exception (2)
- 硬盘数据备份 (1)
- dwr (1)
- svn (1)
- PowerDesigner15使用时的十五个问题 (1)
- tomcat 项目发部路径 (1)
- js 暂停执行 (1)
- jquery jqgrid 格式化数据显示 (1)
- js 代码模板 (1)
- strutss2 直接跳转到jsp页面 (1)
- servlet (1)
- jdbc spring (1)
- js学习网站 (1)
- 自学考试 (2)
- hibernate (2)
- eos (1)
- c (4)
- 黑马 (2)
- 大数据 (2)
- 实战云大数据案例分享 (0)
- Spark (2)
- Flink (1)
最新评论
-
coosummer:
推荐使用http://buttoncssgenerator.c ...
jquery button 漂亮 -
thinktothings:
Array_06 写道你好,我是一名刚毕业学生,我以后就是做J ...
如何转型架构师 -
thinktothings:
软考,考有职业资格证,有系统的知识体系学习
如何转型架构师 -
Array_06:
你好,我是一名刚毕业学生,我以后就是做Java的架构师,那请问 ...
如何转型架构师 -
beykery:
你这也太复杂了。。。。jsf2不应该是这样的。。。。
JSF2.0的一个简单Demo
Quartz Enterprise Job Scheduler Tutorial
Lesson 4: More About Triggers
Like jobs, triggers are quite easy to work with, but do contain a variety of customizable options that you need to be aware of and understand before you can make full use of Quartz. Also, as noted earlier, there are different types of triggers that you can select from to meet different scheduling needs.
You will learn about the two most common types of triggers in Lesson 5: Simple Triggers and Lesson 6: Cron Triggers .
Common Trigger Attributes
Aside from the fact that all trigger types have TriggerKey properties for tracking their identities, there are a number of other properties that are common to all trigger types. These common properties are set using the TriggerBuilder when you are building the trigger definition (examples of that will follow).
Here is a listing of properties common to all trigger types:
- The "jobKey" property indicates the identity of the job that should be executed when the trigger fires.
- The "startTime" property indicates when the trigger's schedule first comes into affect. The value is a java.util.Date object that defines a moment in time on a given calendar date. For some trigger types, the trigger will actually fire at the start time, for others it simply marks the time that the schedule should start being followed. This means you can store a trigger with a schedule such as "every 5th day of the month" during January, and if the startTime property is set to April 1st, it will be a few months before the first firing.
- The "endTime" property indicates when the trigger's schedule should no longer be in effect. In other words, a trigger with a schedule of "every 5th day of the month" and with an end time of July 1st will fire for it's last time on June 5th.
Other properties, which take a bit more explanation are discussed in the following sub-sections.
Priority
Sometimes, when you have many Triggers (or few worker threads in your Quartz thread pool), Quartz may not have enough resources to immediately fire all of the Triggers that are scheduled to fire at the same time. In this case, you may want to control which of your Triggers get first crack at the available Quartz worker threads. For this purpose, you can set the priority property on a Trigger. If N Triggers are to fire at the same time, but there are only Z worker threads currently available, then the first Z Triggers with the highest priority will be executed first. If you do not set a priority on a Trigger, then it will use the default priority of 5. Any integer value is allowed for priority, positive or negative.
Note: Priorities are only compared when triggers have the same fire time. A trigger scheduled to fire at 10:59 will always fire before one scheduled to fire at 11:00.
Note: When a trigger's job is detected to require recovery, its recovery is scheduled with the same priority as the original trigger.
Misfire Instructions
Another important property of a Trigger is its "misfire instruction". A misfire occurs if a persistent trigger "misses" its firing time because of the scheduler being shutdown, or because there are no available threads in Quartz's thread pool for executing the job. The different trigger types have different misfire instructions available to them. By default they use a 'smart policy' instruction - which has dynamic behavior based on trigger type and configuration. When the scheduler starts, it searches for any persistent triggers that have misfired, and it then updates each of them based on their individually configured misfire instructions. When you start using Quartz in your own projects, you should make yourself familiar with the misfire instructions that are defined on the given trigger types, and explained in their JavaDoc. More specific information about misfire instructions will be given within the tutorial lessons specific to each trigger type.
Calendars
Quartz Calendar objects (not java.util.Calendar objects) can be associated with triggers at the time the trigger is defined and stored in the scheduler. Calendars are useful for excluding blocks of time from the the trigger's firing schedule. For instance, you could create a trigger that fires a job every weekday at 9:30 am, but then add a Calendar that excludes all of the business's holidays.
Calendar's can be any serializable objects that implement the Calendar interface, which looks like this:
The Calendar Interface
package org.quartz; public interface Calendar { public boolean isTimeIncluded(long timeStamp); public long getNextIncludedTime(long timeStamp); }
Notice that the parameters to these methods are of the long type. As you may guess, they are timestamps in millisecond format. This means that calendars can 'block out' sections of time as narrow as a millisecond. Most likely, you'll be interested in 'blocking-out' entire days. As a convenience, Quartz includes the class org.quartz.impl.HolidayCalendar, which does just that.
Calendars must be instantiated and registered with the scheduler via the addCalendar(..) method. If you use HolidayCalendar, after instantiating it, you should use its addExcludedDate(Date date) method in order to populate it with the days you wish to have excluded from scheduling. The same calendar instance can be used with multiple triggers such as this:
An Example of using calendars
HolidayCalendar cal = new HolidayCalendar(); cal.addExcludedDate( someDate ); cal.addExcludedDate( someOtherDate ); sched.addCalendar("myHolidays", cal, false); Trigger t = newTrigger() .withIdentity("myTrigger") .forJob("myJob") .withSchedule(dailyAtHourAndMinute(9, 30)) // execute job daily at 9:30 .modifiedByCalendar("myHolidays") // but not on holidays .build(); // .. schedule job with trigger Trigger t2 = newTrigger() .withIdentity("myTrigger2") .forJob("myJob2") .withSchedule(dailyAtHourAndMinute(11, 30)) // execute job daily at 11:30 .modifiedByCalendar("myHolidays") // but not on holidays .build(); // .. schedule job with trigger2
The details of the construction/building of triggers will be given in the next couple lessons. For now, just believe that the code above creates two triggers, each scheduled to fire daily. However, any of the firings that would have occurred during the period excluded by the calendar will be skipped.
See the org.quartz.impl.calendar package for a number of Calendar implementations that may suit your needs.
© 2001-2011 Terracotta, Inc., http://www.terracotta.org
- HolidayCalendarQuartz.zip (859.6 KB)
- 下载次数: 2
发表评论
-
quartz 执行时间配置
2011-09-26 10:23 2515CronTrigger Tutorial Intro ... -
1天有多少毫秒
2011-07-28 14:43 18611、 --1天有多少毫秒 1天=86400000 ... -
Lesson 7: TriggerListeners and c
2011-07-27 14:41 1667Quartz Enterprise Job Scheduler ... -
Lesson 6: CronTrigger
2011-07-27 14:28 1285Quartz Enterprise Job Scheduler ... -
Lesson 5: SimpleTrigger
2011-07-27 14:22 1227Quartz Enterprise Job Scheduler ... -
Lesson 3: More About Jobs and Job Details
2011-07-27 11:58 1370Quartz Enterprise Job Scheduler ... -
Lesson 2: The Quartz API, and Introduction to Jobs And Triggers
2011-07-27 11:34 1296Quartz Enterprise Job Scheduler ... -
Lesson 1: Using Quartz
2011-07-27 11:22 1086Quartz Enterprise Job Scheduler ... -
Examples Overview
2011-07-27 10:24 1026Examples Overview Welcome to t ... -
CronTrigger Tutorial
2011-07-27 10:04 1098http://www.quartz-scheduler.o ... -
quartz-2.0.2-examples
2011-07-27 07:58 1491Cron Triggers Expression ...
相关推荐
在Windows Presentation Foundation (WPF) 中,触发器(Triggers)是XAML中的一种关键特性,它们允许我们根据特定条件改变UI元素的属性或者执行某些行为。触发器分为多种类型,包括数据触发器(DataTriggers)、样式...
资源来自pypi官网。 资源全名:cdk-triggers-0.0.34.tar.gz
资源来自pypi官网。 资源全名:cdk_triggers-0.0.25-py3-none-any.whl
python库。 资源全名:fastybird_triggers_module-0.5.5-py3-none-any.whl
python库。 资源全名:cdk_triggers-0.0.136-py3-none-any.whl
资源分类:Python库 所属语言:Python 资源全名:cdk-triggers-0.0.172.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
资源分类:Python库 所属语言:Python 资源全名:cdk_triggers-0.0.192-py3-none-any.whl 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
资源分类:Python库 所属语言:Python 资源全名:cdk_triggers-0.0.152-py3-none-any.whl 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
The Vagrantfile requires the plugin vagrant-triggers. To install the plugin run: $ vagrant plugin install vagrant-triggers 安装Docker的管理程序 Deis 在 vagrant,需要安装vagrant-triggers,由于网络...
智能流程管理 安排触发: 安装: 通过NPM ... " triggers " : [ { " id " : " schedule_default " , " type " : " @runnerty-trigger-schedule " } ] } 计划样本: 添加 : { " triggers " : [ {
【标题】:“triggers.html”通常指的是MySQL数据库中关于触发器(Triggers)的文档页面。触发器是一种数据库对象,允许在特定的数据操作(如INSERT、UPDATE或DELETE)之前或之后执行预定义的SQL语句,以此实现对...
在这个简易播放器中,开发者直接在XAML文件中定义了触发器(Triggers),以响应用户的交互事件,比如点击播放按钮。这些触发器会改变MediaElement的状态,执行播放、暂停等操作。值得注意的是,这个播放器设计时并未...
4. **自定义行为和触发器**:除了库中提供的行为和触发器,开发者还可以根据需求自定义,继承`Behavior<T>`或`TriggerAction<T>`类。 通过System.Windows.Interactivity库,WPF开发者能够构建更富有表现力和动态性...
quartz-2.2.3版本集群部署方式,需要创建的11张表的sql 文件,很多文章没有分享,一定要注意版本,不同的版本sql脚本不同