quartz是石英钟的意思,所以用这个名字来做定时器的框架名称再适合不过。一年前做项目的时候有用过这个框架,当时没有整理,今天刚好新的商城系统也需要定时器。想要达到的效果是:每天的固定时间,比如凌晨3:00的时候定时扫描数据库,查看所有的订单,看看这些订单是否超过5天还未付款,如果未付款,则将这部分未付款的订单的状态置为取消(或者说放入垃圾回收站)。功能很清晰简单,以下是具体的做法。
第一步,导包。因为是第三方的框架,自然要导包,导入quartz的jar包,这里导入的是quartz-2.2.1.jar这个版本,将其放入到web-inf下的lib中。
第二步,配置。
项目采用的是SSH框架,最好新建一个spring的配置文件,我给他起名为:quartzSping.xml。如图所示。
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAARkAAADyCAIAAAD2hia1AAAWJklEQVR4nO2d7XPbxp3H8e/43XUqsirbOm/9R9SypMxw2nqaXOamzZ3HcUaOnuw4CR0/1Hbi2ONGtizTsuM7M70mqafTBz9MEl1b940UK7bsi21J1NEUKT5pBvcCBLAAdgmQXBCLH7+f2cmQ0O5iqexHAGHsF5oOAJCBFvUAACACXAJADnAJADnAJQDkQMGlG4f/hVuiHhfoL4i4VKtvu8r9Gz9XS6dcWktllnRd15cyKS2di3o8rVnKpMzhgoBQcGl++nuVWqNa267WGuaL7cUv9v9TKZ3gEnUouDQ3+f1ytXF05vbYbz7/5fjVoV//dqvaeHjnvcUv9t+/8bO5ye9HPUBd12PhkrIDiwcUXJoZHyiWG5tbjeJWY3OrsVlubG7ZZWZiIOoB6roOl+hDwaXzBxOFcuPozO0j5/80fubW/vd/92+HbvziYPblfZcKpcb5gwlhy6VMSmvCzKFc2tyYyiyZM8zeKJptvM7sVlZ3jilrtHH0KNods73ZD9u51UWL0bo+l6vPlDV6LZVZcmjlbSj4zfU3FFz64M1kvljPF+sbxXreUz548weCdkuZtDk1cmlzTuTSmuuLgnO+2zXdnXn+pjuqMv2aVb27arU7l3bOxqJqjs/lECGd8/bpklzcEAcwHhRcOrl/cLVQ4x6XVgu1k/sHW7R1/31lZw5Th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AJQDkAJcAkANcAkAOFFxC3gNQAQouUch76AW4aShcKLhEIe+hF8ClcKHgktp5D+3e9xDC/Xv28OBSiFBwSe28B7jUL1BwSeG8B7sH5rmd3owHq2dXffYuPEfHCHhQEAouqZ/34HwcLu/p0twlvS0PUQh4UA0KLsUn70G0/k+0a9eyc+/4sShdISi4FJ+8h3Zdsn/GMwouqQUFl9TPexC75F5Z7jrHy7gaIuBBYSi4pHbeg7nRvvZg792qn0qnHd+SzOON++oHAh4UhoJLauc9gH6Bgktq5z2AfoGCS2rnPYB+gYJLAKgAXAJADnAJADn8P8DEIHg9sOKVAAAAAElFTkSuQmCC" alt="" />
记得将这个配置文件引入到主的配置文件applicationContext.xml中,如图所示。仅需在applicationContext.cml的最后加入这样一句话就可以。
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAnsAAACECAIAAABnDXolAAAgAElEQVR4nO2dPYsjx9bH+/MoNsNFyX6DjSY1ZmBQvOGd4CJhGNhQi90MDiYyjA29wyZeBTY8QsOCHdh3k7tyoGA9cINhFD0bGR7YeoJSd586p976TerW/H+cwNvd9SZ5+q9TdapOorz8/fff/gcAAAAAEEPivw3FBQAAAFoBigsAAADsAyguAAAAsA+ORnHXl9Pps2l6sz10R0AXLNQoUaOJUkpdj9UoUReLahVcJHVKNS/bHf3slYflRI0StbTea/z9KqWU2s6vZsnV3aZBJwHoFChud2xv0umzdHV/6H4cAR/napSo07lS+Rt5WbEGrU/XtV7GtctqjSlsWafx9nt1KC5yTZU0/36VUmp7N57NJuv6PQSga45GcXsIFLc1tHRpdblI1GisPh64RyE26pT1c6NO+9/t7tio01xTJa18v4tbOLig7wxQcbd349nVvEe+rAsobmtcj/O3sPfF3R/qO2rHysI3V9zG97uezGbjO/pe2M6v2BUADszAFHdzd5XMZsktnTnS88k7u6R3tqvzaXqz3T1wuVb3q/TZtFTBd5n+b1JDxuakgpXndZI5bXKFWfYuapCrNElXG7Wdp9NkOk2m0yRdGT/d19nuuryllNquxp67tOw0I2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KK7FyufvVym7G624yr+OS9CKizVdAAAAnZD8858/em47ZpUtmqpZ3NoluaqPS9Fyy+aNqyhuTh5+dSlvYlYZAABAx7QbOcU3BRX4ddE7h6w9VF62juIqx7IuIqcAAAB0T5u7gzZ3V651UKaL7zJzgld7nw6ZNB7O/dRYxV1ntFoRBY3dQQAAAPZEiydgWDYFkYeNDbU2j5av5vK9Q+VC7PYmreDjmmvAbB0XJ2AAAADYE+2d8mjbFAQAAAAATVuKa98UBAAAAADNIfPjAgAAAE8HKC4AAACwD6C4AAAAwD74fzo9p6gyWnsmAAAAAElFTkSuQmCC" alt="" />
接下来就是配置quartzSpring.xml这个文件了。
1.首先,我们先新建一个java类,这个类中的代码将作为定时器触发时所要执行的代码。新建一个RealOrderQuart.java类。如下所示。
package wonyen.yipin.action; import wonyen.yipin.service.RealOrderService; public class RealOrderQuartz {
/**
* 订单定时扫描,判断是否满足取消条件
*/
private RealOrderService realOrderService; public RealOrderService getRealOrderService() {
return realOrderService;
} public void setRealOrderService(RealOrderService realOrderService) {
this.realOrderService = realOrderService;
} public void orderQuartz() {
//此处编写定时器触发时候执行的代码 } }
2.先配置刚才新建的那个java类,如下所示。
<!-- 订单扫描类 -->
<bean id="realOrderQuartz" class="wonyen.yipin.action.RealOrderQuartz"
scope="prototype">
<property name="realOrderService" ref="realOrderService" />
</bean>
3.配置quartz的任务具体信息,即MethodInvokingJobDetailFactoryBean,任务详情的工厂。
<!-- quartz任务详情工厂 -->
<bean id="realOrderQuartzJobDetail"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject">
<ref bean="realOrderQuartz" />
</property>
<property name="targetMethod"> <!-- 要执行的方法名称 -->
<value>orderQuartz</value>
</property>
</bean>
4.配置定时规则触发器,配置定时触发规则有两种不同的实现类,一种是org.springframework.scheduling.quartz.SimpleTriggerBean,另外一种是org.springframework.scheduling.quartz.CronTriggerBean。区别在于前者只能做简单的定时,比如每隔多久触发一次,而后者可以使用cron表达式来自定义定时的规则。这边我采用后者。配置了从周一到周日,每天的3点20触发。cron表达式的具体用法可自行百度。这边的jobDetail属性填写上一步配置的任务详情,即realOrderQuartzJobDetail。
<!-- 配置定时规则,Cron表达式 ,调度触发器 -->
<bean class="org.springframework.scheduling.quartz.CronTriggerFactoryBean"
id="cronRealOrderTrigger">
<property name="jobDetail" ref="realOrderQuartzJobDetail">
</property>
<!-- 秒 分 时 日 月 星期 -->
<property name="cronExpression" value="0 20 03 ? * 1,2,3,4,5,6,7">
</property>
</bean>
5.配置调度工厂,在调度工厂中,我们调度相应的触发器。这里就是调度上一步配置的cronRealOrderTrigger触发器。
<!-- 调度工厂 -->
<bean id="realOrderQuartzScheduler"
class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="cronRealOrderTrigger" />
</list>
</property>
</bean>
这样,我们就配置成功了。运行程序,到指定的时间,就可以触发定时器中的代码了。
使用spring配置quartz定时器的更多相关文章
-
Spring的quartz定时器同一时刻重复执行二次的问题解决
最近用Spring的quartz定时器的时候,发现到时间后,任务总是重复执行两次,在tomcat或jboss下都如此. 打印出他们的hashcode,发现是不一样的,也就是说,在web容器启动的时候, ...
-
Spring的quartz定时器重复执行二次的问题解决
Spring的quartz定时器同一时刻重复执行二次的问题解决 最近用Spring的quartz定时器的时候,发现到时间后,任务总是重复执行两次,在tomcat或jboss下都如此. 打印出他们的ha ...
-
【spring配置】——spring整合Quartz定时器
第一种:为普通java类中的某个方法配置跑批任务 MethodInvokingJobDetailFactoryBean CronTriggerBean SchedulerFactoryBean 1.定 ...
-
在spring框架中配置Quartz定时器发生错误: class org.springframework.scheduling.quartz.JobDetailBean has interface org.quartz.JobDetail as sup
这是由于spring和Quartz的不兼容性造成的.我的spring是4.0.2,但是Quartz是2.2.3的,换了一个1.8版本的Quartz就解决问题了.
-
关于Spring的Quartz定时器设定
在实际的开发业务中经常会遇到定时执行某个任务,如果项目使用的ssh框架的话,就需要配合spring来使用定时器.spring的定时器是一个固定的配置格式,具体的applicationContext配置 ...
-
Spring配置Quartz任务调度、及 ThreadPool 线程池
ONE.除了引入 Spring 相关的 jar 包,还要引入 Quartz 的 jar 包 <dependency> <groupId>org.springframework& ...
-
spring启动quartz定时器
在很多中经常要用到定时任务,quartz是定时器中比较好用的,在Spring中使用quartz是很容易的事情,首先在spring的applicationContext.xml文件中增加如下配置: &l ...
-
Spring集成Quartz定时器
<!-- Spring集成Quartz开始 --> <bean id="startQuertz" lazy-init="false" auto ...
-
基于spring和Quartz定时器
最近做一个小项目,要每7天去调用webservice获取一次数据.所以就用定时器来完成spring是4.1.6,quartz是2.2.1. 首先配置spring的xml文件.首先定义你要被执行的类 & ...
随机推荐
-
angular 控制器的使用两种模式
angular.module("myApp",[]) .controller("firstCtrl",["$scope",function( ...
-
【转】Using Gamma 2.2
This is a detailed description of the work with Gamma 2.2. If you are only interested in exact instr ...
-
centos dns配置
vi /etc/sysconfig/network-scripts/ifcfg-[tab两下] 新增以下修改 ONBOOT=yes #开启自动启用网络连接 IPADDR0=192.168.21.12 ...
-
POJ 3461 Oulipo KMP
题意:统计其中一个子串的出现次数 题解:即KMP算法中j==m的次数 //作者:1085422276 #include <cstdio> #include <cmath> #i ...
-
js弹出确认框,挺全
一种: <a href="javascript:if(confirm('确实要删除该内容吗?'))location='http://www.google.com'">弹 ...
-
cocos2d-x 中添加显示文字的三种方式 LabelTTF 、LabelBMFont 和 LabelAtlas
在 cocos2d-x 中有三个类可以在层或精灵中添加文字: LabelTTF LabelBMFont LabelAtlas LabelTTF 直接支持使用 TTF 字库,可以支持全部的中文,但是效率 ...
-
51 Nod 1791 合法括号子段【分治+字符串】
1791 合法括号子段 基准时间限制:1 秒 空间限制:131072 KB 分值: 40 难度:4级算法题 有一个括号序列,现在要计算一下它有多少非空子段是合法括号序列. 合法括号序列的定义是: 1. ...
-
linux命令之 tar
参数 -c 创建新归档 -d 比较归档和文件系统的差异 -r 追加文件到归档 -t 存档的内容列表 -x 提取归档所有文件 -C 改变解压目录 -f 使用归档文件或设备归档 -j bzip2 压缩 - ...
-
Buffer cache hit ratio性能计数器真的可以作为SQL Server 内存瓶颈的判断指标吗?
SQL Server中对于Buffer cache hit ratio的理解: Buffer cache hit ratio官方是这么解释的:“指示在缓冲区高速缓存中找到而不需要从磁盘中读取的页的百分 ...
-
mysql的utf8与utf8mb4 异同;utf8mb4_unicode_ci 与 utf8mb4_general_ci 如何选择
如图,一般使用如下配置 utf8mb4是4个字节.utf8是3个字节.utf8mb4兼容性更好,占用空间更大. 主要从排序准确性和性能两方面看: 准确性utf8mb4_unicode_ci 是基于标准 ...