- 浏览: 981064 次
文章分类
- 全部博客 (428)
- Hadoop (2)
- HBase (1)
- ELK (1)
- ActiveMQ (13)
- Kafka (5)
- Redis (14)
- Dubbo (1)
- Memcached (5)
- Netty (56)
- Mina (34)
- NIO (51)
- JUC (53)
- Spring (13)
- Mybatis (17)
- MySQL (21)
- JDBC (12)
- C3P0 (5)
- Tomcat (13)
- SLF4J-log4j (9)
- P6Spy (4)
- Quartz (12)
- Zabbix (7)
- JAVA (9)
- Linux (15)
- HTML (9)
- Lucene (0)
- JS (2)
- WebService (1)
- Maven (4)
- Oracle&MSSQL (14)
- iText (11)
- Development Tools (8)
- UTILS (4)
- LIFE (8)
最新评论
-
Donald_Draper:
Donald_Draper 写道刘落落cici 写道能给我发一 ...
DatagramChannelImpl 解析三(多播) -
Donald_Draper:
刘落落cici 写道能给我发一份这个类的源码吗Datagram ...
DatagramChannelImpl 解析三(多播) -
lyfyouyun:
请问楼主,执行消息发送的时候,报错:Transport sch ...
ActiveMQ连接工厂、连接详解 -
ezlhq:
关于 PollArrayWrapper 状态含义猜测:参考 S ...
WindowsSelectorImpl解析一(FdMap,PollArrayWrapper) -
flyfeifei66:
打算使用xmemcache作为memcache的客户端,由于x ...
Memcached分布式客户端(Xmemcached)
首先这个所有的依赖包就不需要多讲了,首先下载Quazrt发布包,解压,运行doc文件夹下(E:\Quartz\quartz-2.2.3\docs\dbTables)的tables_mysql_innodb.sql脚本
新建job
//MyJob 普通job,这个不需要实现org.quartz.Job
//MyQuartzJob,这个job因为我们要把job持久化到RDB所以要实现org.quartz.Job
Spring与Quartz的集成配置
//SchedulerFactoryBean配置
//定时任务配置
quartz-task.xm
启动web控制台输出:
信息: Server startup in 11783 ms
2016-09-09 17:44:00 -32594 [org.springframework.scheduling.quartz.SchedulerFactoryBean] INFO - Starting Quartz Scheduler now, after delay of 30 seconds
2016-09-09 17:44:00 -32660 [org.quartz.core.QuartzScheduler] INFO - Scheduler defaultScheduler_$_donaldHP1473414210553 started.
2016-09-09 17:44:01 -32758 [job.MyQuartzJob] INFO - ==================:job.MyQuartzJob was just triggered...
2016-09-09 17:44:01 -32802 [job.MyQuartzJob] INFO - ==================:job.MyQuartzJob was just triggered...
2016-09-09 17:44:01 -32842 [job.MyQuartzJob] INFO - ==================:job.MyQuartzJob was just triggered...
查看数据库Quartz,job,trriger相关信息:
mysql> use test;
Database changed
mysql> select * from qrtz_cron_triggers;
+------------------+--------------------------+---------------+-----------------+---------------+
| SCHED_NAME | TRIGGER_NAME | TRIGGER_GROUP | CRON_EXPRESSION | TIME_ZONE_ID |
+------------------+--------------------------+---------------+-----------------+---------------+
| defaultScheduler | cronTestQuartzJobTrigger | DEFAULT | 0/5 * * * * ? | Asia/Shanghai |
+------------------+--------------------------+---------------+-----------------+---------------+
1 row in set
mysql> select * from qrtz_fired_triggers;
+------------------+------------------------------------+--------------------------+---------------+-----------------------+---------------+---------------+----------+----------+----------+-----------+------------------+-------------------+
| SCHED_NAME | ENTRY_ID | TRIGGER_NAME | TRIGGER_GROUP | INSTANCE_NAME | FIRED_TIME | SCHED_TIME | PRIORITY | STATE | JOB_NAME | JOB_GROUP | IS_NONCONCURRENT | REQUESTS_RECOVERY |
+------------------+------------------------------------+--------------------------+---------------+-----------------------+---------------+---------------+----------+----------+----------+-----------+------------------+-------------------+
| defaultScheduler | donaldHP14734142105531473414210556 | cronTestQuartzJobTrigger | DEFAULT | donaldHP1473414210553 | 1473414385029 | 1473414390000 | 0 | ACQUIRED | NULL | NULL | 0 | 0 |
+------------------+------------------------------------+--------------------------+---------------+-----------------------+---------------+---------------+----------+----------+----------+-----------+------------------+-------------------+
1 row in set
mysql> select * from qrtz_triggers;
+------------------+--------------------------+---------------+-------------+-----------+-------------+----------------+----------------+----------+---------------+--------------+---------------+----------+---------------+---------------+----------+
| SCHED_NAME | TRIGGER_NAME | TRIGGER_GROUP | JOB_NAME | JOB_GROUP | DESCRIPTION | NEXT_FIRE_TIME | PREV_FIRE_TIME | PRIORITY | TRIGGER_STATE | TRIGGER_TYPE | START_TIME | END_TIME | CALENDAR_NAME | MISFIRE_INSTR | JOB_DATA |
+------------------+--------------------------+---------------+-------------+-----------+-------------+----------------+----------------+----------+---------------+--------------+---------------+----------+---------------+---------------+----------+
|defaultScheduler | cronTestQuartzJobTrigger | DEFAULT | myQuartzJob | DEFAULT | NULL | 1473414390000 | 1473414385000 | 0 | ACQUIRED | CRON | 1473414210000 | 0 | NULL | 0 | |
+------------------+--------------------------+---------------+-------------+-----------+-------------+----------------+----------------+----------+---------------+--------------+---------------+----------+---------------+---------------+----------+
1 row in set
mysql> select * from qrtz_job_details;
+------------------+-------------+------------------+-------------+-----------------+------------+------------------+----------------+-------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| SCHED_NAME | JOB_NAME | JOB_GROUP | DESCRIPTION | JOB_CLASS_NAME | IS_DURABLE | IS_NONCONCURRENT | IS_UPDATE_DATA | REQUESTS_RECOVERY | JOB_DATA
| defaultScheduler | myQuartzJob | DEFAULT | NULL | job.MyQuartzJob | 1 | 0 | 0 | 0 |
?
loadFactorI
mysql> select * from qrtz_locks;
+------------------+----------------+
| SCHED_NAME | LOCK_NAME |
+------------------+----------------+
| defaultScheduler | STATE_ACCESS |
| defaultScheduler | TRIGGER_ACCESS |
+------------------+----------------+
2 rows in set
mysql> select * from qrtz_scheduler_state;
+------------------+-----------------------+-------------------+------------------+
| SCHED_NAME | INSTANCE_NAME | LAST_CHECKIN_TIME | CHECKIN_INTERVAL |
+------------------+-----------------------+-------------------+------------------+
| defaultScheduler | donaldHP1473414210553 | 1473414375985 | 15000 |
+------------------+-----------------------+-------------------+------------------+
1 row in set
说明:
定时任务配置有两种方式
第一种:MethodInvokingJobDetailFactoryBean
如果用这种方式的话,要屏蔽一下配置
第二种:JobDetailFactoryBean
主要是JobDetailFactory得实现不同,第一种不需要实现org.quartz.Job,而第二种需要实现org.quartz.Job;为什么会有这两种方式呢,用的时候该用那种方式,第一种方式定时任务存在RAM中,应用启动时,任务信息及任务调度信息易丢失,要避免任务信息及任务调度信息,需将任务相关信息持久化到RDB,这就是第二种方式的job为什么要实现org.quartz.Job原因,因为保存到数据库需要job-bean的相关信息。
了解更多关于任务持久化到RDB,请参考:
Quartz 任务存储JobStoreTX 持久化之RDB-源码分析:http://donald-draper.iteye.com/admin/blogs/2323409
新建job
//MyJob 普通job,这个不需要实现org.quartz.Job
package job; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class MyJob { Logger log = LoggerFactory.getLogger(MyJob.class); public void work () { // 此任务仅打印日志便于调试、观察 log.info("==================:"+this.getClass().getName() + " was just triggered..."); } }
//MyQuartzJob,这个job因为我们要把job持久化到RDB所以要实现org.quartz.Job
package job; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class MyQuartzJob implements Job{ Logger log = LoggerFactory.getLogger(MyQuartzJob.class); @Override public void execute(JobExecutionContext jobexecutioncontext) throws JobExecutionException { log.info("==================:"+this.getClass().getName() + " was just triggered..."); } }
Spring与Quartz的集成配置
//SchedulerFactoryBean配置
quartz.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <!-- 调度工厂 --> <bean id="quartzScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="quartzProperties"> <props> <prop key="org.quartz.scheduler.instanceName">defaultScheduler</prop> <prop key="org.quartz.scheduler.instanceId">AUTO</prop> <!-- 线程池配置 --> <prop key="org.quartz.threadPool.class">org.quartz.simpl.SimpleThreadPool</prop> <prop key="org.quartz.threadPool.threadCount">20</prop> <prop key="org.quartz.threadPool.threadPriority">5</prop> <!-- JobStore配置 --> <prop key="org.quartz.jobStore.class">org.quartz.impl.jdbcjobstore.JobStoreTX</prop> <!-- 集群配置 --> <prop key="org.quartz.jobStore.isClustered">true</prop> <prop key="org.quartz.jobStore.clusterCheckinInterval">15000</prop> <prop key="org.quartz.jobStore.maxMisfiresToHandleAtATime">1</prop> <prop key="org.quartz.jobStore.misfireThreshold">120000</prop> <!-- 表名配置 --> <prop key="org.quartz.jobStore.tablePrefix">QRTZ_</prop> </props> </property> <property name="schedulerName" value="defaultScheduler" /> <!-- 必须的,QuartzScheduler 延时启动,应用启动完后 QuartzScheduler 再启动 --> <property name="startupDelay" value="30" /> <property name="applicationContextSchedulerContextKey" value="applicationContextKey" /> <!-- 可选,QuartzScheduler 启动时更新己存在的Job,这样就不用每次修改targetObject后删除qrtz_job_details表对应记录了 --> <property name="overwriteExistingJobs" value="true" /> <!-- 设置自动启动 --> <property name="autoStartup" value="true" /> <!-- 注册触发器 --> <property name="triggers"> <ref bean="defaultTriggers" /> </property> <!-- 注册jobDetail --> <property name="jobDetails"> <ref bean="defaultJobDetails" /> </property> <!-- 注册监听器 --> <property name="schedulerListeners"> <ref bean="defaultSchedulerListeners" /> </property> </bean> <import resource="quartz-task.xml" /> </beans>
//定时任务配置
quartz-task.xm
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> <!-- 工作的bean --> <bean id="myJob" class="job.MyJob" /> <!-- job的配置开始 --> <bean id="myJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <property name="targetObject" ref="myJob" /> <property name="targetMethod" value="work" /> <!-- <property name="concurrent" value="false" /> --> </bean> <bean id="myQuartzJobDetail" class="org.springframework.scheduling.quartz.JobDetailFactoryBean"> <property name="jobClass" value="job.MyQuartzJob" /> <property name="name" value="myQuartzJob" /> <!-- 任务完成之后是否依然保留到数据库,默认false --> <property name="durability" value="true" /> </bean> <!-- job的配置结束 --> <!-- 调度任务配置开始 --> <bean id="cronTestJobTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean"> <property name="jobDetail" ref="myJobDetail" /> <!-- Cron表达式“0/5 * * * * ?”意为:每5秒执行一次。 --> <property name="cronExpression" value="0/5 * * * * ?" /> </bean> <bean id="cronTestQuartzJobTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean"> <property name="jobDetail" ref="myQuartzJobDetail" /> <property name="cronExpression" value="0/5 * * * * ?" /> </bean> <!-- 默认调度器(defaultScheduler)触发器配置 --> <util:list id="defaultTriggers"> <!-- <ref bean="crontestJobTrigger"/> --> <ref bean="cronTestQuartzJobTrigger" /> </util:list> <!-- 默认调度器(defaultScheduler)Job实例配置 --> <util:list id="defaultJobDetails"> </util:list> <!-- 默认调度器(defaultScheduler)监听器配置 --> <util:list id="defaultSchedulerListeners"> </util:list> <!-- JobDetail-配置示例 --> <!-- <bean id="demoJobDetail" class="org.springframework.scheduling.quartz.JobDetailFactoryBean"> <property name="jobClass" value="job.MyQuartzJob" /> <property name="jobDataAsMap"> <map> <entry key="key" value="value" /> </map> </property> </bean> --> </beans>
启动web控制台输出:
信息: Server startup in 11783 ms
2016-09-09 17:44:00 -32594 [org.springframework.scheduling.quartz.SchedulerFactoryBean] INFO - Starting Quartz Scheduler now, after delay of 30 seconds
2016-09-09 17:44:00 -32660 [org.quartz.core.QuartzScheduler] INFO - Scheduler defaultScheduler_$_donaldHP1473414210553 started.
2016-09-09 17:44:01 -32758 [job.MyQuartzJob] INFO - ==================:job.MyQuartzJob was just triggered...
2016-09-09 17:44:01 -32802 [job.MyQuartzJob] INFO - ==================:job.MyQuartzJob was just triggered...
2016-09-09 17:44:01 -32842 [job.MyQuartzJob] INFO - ==================:job.MyQuartzJob was just triggered...
查看数据库Quartz,job,trriger相关信息:
mysql> use test;
Database changed
mysql> select * from qrtz_cron_triggers;
+------------------+--------------------------+---------------+-----------------+---------------+
| SCHED_NAME | TRIGGER_NAME | TRIGGER_GROUP | CRON_EXPRESSION | TIME_ZONE_ID |
+------------------+--------------------------+---------------+-----------------+---------------+
| defaultScheduler | cronTestQuartzJobTrigger | DEFAULT | 0/5 * * * * ? | Asia/Shanghai |
+------------------+--------------------------+---------------+-----------------+---------------+
1 row in set
mysql> select * from qrtz_fired_triggers;
+------------------+------------------------------------+--------------------------+---------------+-----------------------+---------------+---------------+----------+----------+----------+-----------+------------------+-------------------+
| SCHED_NAME | ENTRY_ID | TRIGGER_NAME | TRIGGER_GROUP | INSTANCE_NAME | FIRED_TIME | SCHED_TIME | PRIORITY | STATE | JOB_NAME | JOB_GROUP | IS_NONCONCURRENT | REQUESTS_RECOVERY |
+------------------+------------------------------------+--------------------------+---------------+-----------------------+---------------+---------------+----------+----------+----------+-----------+------------------+-------------------+
| defaultScheduler | donaldHP14734142105531473414210556 | cronTestQuartzJobTrigger | DEFAULT | donaldHP1473414210553 | 1473414385029 | 1473414390000 | 0 | ACQUIRED | NULL | NULL | 0 | 0 |
+------------------+------------------------------------+--------------------------+---------------+-----------------------+---------------+---------------+----------+----------+----------+-----------+------------------+-------------------+
1 row in set
mysql> select * from qrtz_triggers;
+------------------+--------------------------+---------------+-------------+-----------+-------------+----------------+----------------+----------+---------------+--------------+---------------+----------+---------------+---------------+----------+
| SCHED_NAME | TRIGGER_NAME | TRIGGER_GROUP | JOB_NAME | JOB_GROUP | DESCRIPTION | NEXT_FIRE_TIME | PREV_FIRE_TIME | PRIORITY | TRIGGER_STATE | TRIGGER_TYPE | START_TIME | END_TIME | CALENDAR_NAME | MISFIRE_INSTR | JOB_DATA |
+------------------+--------------------------+---------------+-------------+-----------+-------------+----------------+----------------+----------+---------------+--------------+---------------+----------+---------------+---------------+----------+
|defaultScheduler | cronTestQuartzJobTrigger | DEFAULT | myQuartzJob | DEFAULT | NULL | 1473414390000 | 1473414385000 | 0 | ACQUIRED | CRON | 1473414210000 | 0 | NULL | 0 | |
+------------------+--------------------------+---------------+-------------+-----------+-------------+----------------+----------------+----------+---------------+--------------+---------------+----------+---------------+---------------+----------+
1 row in set
mysql> select * from qrtz_job_details;
+------------------+-------------+------------------+-------------+-----------------+------------+------------------+----------------+-------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| SCHED_NAME | JOB_NAME | JOB_GROUP | DESCRIPTION | JOB_CLASS_NAME | IS_DURABLE | IS_NONCONCURRENT | IS_UPDATE_DATA | REQUESTS_RECOVERY | JOB_DATA
| defaultScheduler | myQuartzJob | DEFAULT | NULL | job.MyQuartzJob | 1 | 0 | 0 | 0 |
?
loadFactorI
mysql> select * from qrtz_locks;
+------------------+----------------+
| SCHED_NAME | LOCK_NAME |
+------------------+----------------+
| defaultScheduler | STATE_ACCESS |
| defaultScheduler | TRIGGER_ACCESS |
+------------------+----------------+
2 rows in set
mysql> select * from qrtz_scheduler_state;
+------------------+-----------------------+-------------------+------------------+
| SCHED_NAME | INSTANCE_NAME | LAST_CHECKIN_TIME | CHECKIN_INTERVAL |
+------------------+-----------------------+-------------------+------------------+
| defaultScheduler | donaldHP1473414210553 | 1473414375985 | 15000 |
+------------------+-----------------------+-------------------+------------------+
1 row in set
说明:
定时任务配置有两种方式
第一种:MethodInvokingJobDetailFactoryBean
<bean id="myJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <property name="targetObject" ref="myJob" /> <property name="targetMethod" value="work" /> <!-- <property name="concurrent" value="false" /> --> </bean>
如果用这种方式的话,要屏蔽一下配置
<property name="dataSource" ref="dataSource" /> <property name="quartzProperties"> <props> <prop key="org.quartz.scheduler.instanceName">defaultScheduler</prop> <prop key="org.quartz.scheduler.instanceId">AUTO</prop> <!-- 线程池配置 --> <prop key="org.quartz.threadPool.class">org.quartz.simpl.SimpleThreadPool</prop> <prop key="org.quartz.threadPool.threadCount">20</prop> <prop key="org.quartz.threadPool.threadPriority">5</prop> <!-- JobStore配置 --> <prop key="org.quartz.jobStore.class">org.quartz.impl.jdbcjobstore.JobStoreTX</prop> <!-- 集群配置 --> <prop key="org.quartz.jobStore.isClustered">true</prop> <prop key="org.quartz.jobStore.clusterCheckinInterval">15000</prop> <prop key="org.quartz.jobStore.maxMisfiresToHandleAtATime">1</prop> <prop key="org.quartz.jobStore.misfireThreshold">120000</prop> <!-- 表名配置 --> <prop key="org.quartz.jobStore.tablePrefix">QRTZ_</prop> </props> </property>
第二种:JobDetailFactoryBean
<bean id="myQuartzJobDetail" class="org.springframework.scheduling.quartz.JobDetailFactoryBean"> <property name="jobClass" value="job.MyQuartzJob" /> <property name="name" value="myQuartzJob" /> <!-- 任务完成之后是否依然保留到数据库,默认false --> <property name="durability" value="true" /> </bean>
主要是JobDetailFactory得实现不同,第一种不需要实现org.quartz.Job,而第二种需要实现org.quartz.Job;为什么会有这两种方式呢,用的时候该用那种方式,第一种方式定时任务存在RAM中,应用启动时,任务信息及任务调度信息易丢失,要避免任务信息及任务调度信息,需将任务相关信息持久化到RDB,这就是第二种方式的job为什么要实现org.quartz.Job原因,因为保存到数据库需要job-bean的相关信息。
了解更多关于任务持久化到RDB,请参考:
Quartz 任务存储JobStoreTX 持久化之RDB-源码分析:http://donald-draper.iteye.com/admin/blogs/2323409
发表评论
-
TreeSet在Quartz任务调度过程中的作用
2017-08-24 23:43 725红黑树详解:http://www.cnblogs.com/sk ... -
Quartz使用与Spring集成系列教程
2016-10-26 09:48 496Quartz的使用:http://donald-draper. ... -
Spring的RequestMappingHandlerMapping详解
2016-09-23 08:40 4594深刻理解IdentityHashMap:http://dona ... -
Spring-RequestMappingHandlerAdapter初始化及请求处理
2016-09-22 11:50 10573看这篇文章之前,最好先看下面这篇,以便更好的理解handler ... -
Spring+Mybatis多数据源的实现
2016-09-21 18:15 3094浅谈Spring事务隔离级别:http://www.cnblo ... -
Spring的DefaultAnnotationHandlerMapping详解
2016-09-20 08:47 5841前面我们讲解过Dispatcher ... -
Spring-DispatcherServlet请求处理
2016-09-19 15:42 1687Spring-DispatcherServlet初始化详解:h ... -
Spring-DispatcherServlet初始化详解
2016-09-19 15:03 3691Spring-DispatcherServlet请求处理:ht ... -
Spring上下文加载监听器ContextLoaderListener--源码解析
2016-09-18 18:10 4659一般在web应用配置Spring上下文如下,那么Context ... -
JobDetailFactoryBean与MethodInvokingJobDetailFactoryBean源码分析
2016-09-13 16:07 4302Spring与Quartz集成详解:http://donald ... -
Spring与Quartz集成-源码分析
2016-09-13 11:50 2714在阅读以下文章之前,如果对Quartz任务调度不是很熟悉,请看 ... -
Quartz 任务存储JobStoreTX 持久化之RDB-源码分析
2016-09-08 18:24 2321Quartz 任务存储JobStoreTX 持久化之RDB:h ... -
Quartz 任务存储JobStoreTX 持久化之RDB
2016-09-08 11:52 2822Quartz储存方式之JDBC JobStoreTX:http ... -
Quartz任务调度源码分析
2016-09-07 13:12 3569Quartz的使用:http://donald-draper. ... -
Quartz的job调度源码分析
2016-09-06 13:03 8Quartz的使用:http://donald ... -
Quartzs的job,trriger监听器源码分析
2016-09-06 11:15 1482Quartz的使用:http://donald-draper. ... -
Quartz的job、触发器的暂停与恢复源码分析
2016-09-06 09:01 5265Quartz的使用:http://donald-draper. ... -
Quartz的Scheduler初始化源码分析
2016-09-05 16:14 3589Quartz的使用:http://donald ... -
Quartzs的job存储,触发器、job删除源码分析
2016-09-05 15:39 4549前言:unscheduleJob针对TriggerKey,而d ... -
Quartz的使用
2016-09-05 11:39 1786Quartz使用总结:http://www.cnblogs.c ...
相关推荐
【Spring与Quartz集成详解】 在Java开发中,我们经常需要进行定时任务的调度,以实现后台自动执行某些业务逻辑。Spring框架提供了丰富的功能,而Quartz是一个强大的、完全开源的作业调度框架,用于在Java应用程序中...
Spring 提供了与 Quartz 集成的模块,使得在 Spring 应用程序中使用 Quartz 更加便捷,包括 Job 实例的管理、触发器的配置以及对 Quartz Scheduler 的控制。 在这个 "spring+quartz demo" 中,我们可以学习到如何将...
【Spring集成Quartz定时任务与数据库实现集群详解】 在企业级应用中,定时任务的管理是必不可少的一部分,Spring框架提供了与Quartz的集成,使得我们可以方便地创建和管理定时任务。Quartz是一款强大的、开放源代码...
### Spring集成Quartz调度框架详解 #### 一、Quartz调度框架概述 Quartz是一个开源的、成熟的作业调度框架,其主要目标是在Java应用程序中提供简单而强大的作业调度能力。Quartz支持作业按时间间隔(如每天、每周...
"springquartz—项目可以直接运行" 这个压缩包中,通常会包含以下部分: 1. **pom.xml**:Maven 项目配置文件,包含了 Spring 和 Quartz 相关依赖。 2. **src/main/java**:源代码目录,可能包含自定义的 Job 类、...
Spring集成Quartz定时任务框架是Java开发中常用的一种任务调度工具,它可以帮助开发者在特定时间执行重复或一次性任务。Quartz作为一个开源的作业调度框架,提供了丰富的API来创建、调度和管理作业。本文将深入探讨...
### Spring中Quartz的配置详解 #### 一、前言 Spring框架因其强大的功能和灵活性在企业级应用开发中占据了一席之地。其中,对于定时任务的支持,Spring结合了Quartz这一优秀的开源任务调度框架,提供了更为灵活和...
#### 二、Spring与Quartz集成步骤详解 ##### 1. 增加所依赖的JAR包 首先,需要确保项目中引入了Spring和Quartz的相关依赖。这可以通过添加Maven依赖来实现: - **Spring依赖**: ```xml <groupId>org.spring...
《Spring与Quartz实现定时任务详解》 在Java开发中,定时任务的处理是一项重要的功能,它能够按照预设的时间规律自动执行特定的任务,比如数据同步、报表生成等。Spring框架,作为Java企业级应用的基石,提供了丰富...
**Spring+Quartz定时调度详解** 在Java世界中,实现定时任务调度是非常常见的需求,Spring框架结合Quartz库提供了一种高效且灵活的解决方案。本文将深入探讨Spring与Quartz的整合,以及如何利用它们来创建和管理...
**Spring Quartz时间调用框架详解** Spring Quartz是一个在Spring框架中集成的时间调度插件,它允许开发者方便地创建和管理定时任务。Quartz是Java领域的一款功能强大的作业调度库,而Spring通过其优秀的IoC...
### Spring与Quartz集成知识点详解 #### 一、Spring与Quartz概述 Spring是一个轻量级的Java开发框架,主要用于简化企业级应用的开发过程。它提供了强大的依赖注入(DI)功能,使得开发者能够轻松地管理和组织应用...
在Java开发中,任务调度是不可或缺的一部分,Spring框架提供了与Quartz集成的能力,使得我们可以方便地管理和执行定时任务。本文将详细介绍如何通过Spring和Quartz搭建任务调度系统,并解析配置文件中的关键组件及其...
### Spring整合Quartz常见问题详解 #### 一、Spring整合Quartz概述 Spring与Quartz的集成是企业级应用中非常常见的技术组合之一。Quartz是一个功能强大的作业调度框架,而Spring则是Java领域中广泛使用的轻量级控制...
Spring Quartz 集群配置详解 在分布式系统中,定时任务的管理往往是一个重要的环节,Spring与Quartz的结合能够帮助我们实现复杂的工作调度。Quartz是一个开源的作业调度框架,它提供了高度可配置的定时任务执行能力...
在"springboot-quartz案例"中,我们看到的是一个完整的项目实例,它演示了如何将Quartz集成到SpringBoot应用中以实现任务调度。这个案例可能包含了以下关键知识点: 1. **SpringBoot基础**:SpringBoot简化了Spring...
将Quartz与Spring集成可以充分利用Spring的依赖注入功能,简化Quartz的配置过程。 ##### 2.1 导入必要的库 - **Struts项目**:对于使用Struts的项目,需要直接导入以下JAR包: - `spring.jar`:Spring核心库。 -...
Quartz是一个开源的作业调度框架,而Spring则提供了与Quartz的完美集成,使得在Spring应用中配置和管理定时任务变得简单易行。 首先,我们需要理解Quartz的基本概念。Quartz的核心是Job和Trigger。Job代表一个具体...
【Spring + Quartz 知识点详解】 Spring 和 Quartz 是在 Java 开发中广泛使用的两个库,它们分别在依赖注入和任务调度方面发挥着重要作用。Spring 是一个强大的企业级应用框架,提供诸如 AOP(面向切面编程)、DI...
`QuartzJobBean`是一个抽象基类,提供了与Quartz集成的基础设施,它的`executeInternal`方法是实际运行的任务代码。在`JudgeDateQuartzJobBean`中,这个方法执行了一个数据库查询,查询`PE_JPC_ITEM_INFO`表中所有...