Quartz1.8任务进程管理系统学习笔记一:版本1.8和之前版本的不同

版本1.8和之前版本在xml插件配置上有所不同:

1、quartz.properties文件中的配置参数改变

   之前版本:

#============================================================================
# Configure Plugins 
#============================================================================

org.quartz.plugin.triggHistory.class = org.quartz.plugins.history.LoggingJobHistoryPlugin

org.quartz.plugin.jobInitializer.class = org.quartz.plugins.xml.JobInitializationPlugin
org.quartz.plugin.jobInitializer.fileNames = quartz_data.xml
org.quartz.plugin.jobInitializer.failOnFileNotFound = true
org.quartz.plugin.jobInitializer.scanInterval = 120
org.quartz.plugin.jobInitializer.wrapInUserTransaction = false

    1.8版本

#============================================================================
# Configure Plugins 
#============================================================================

org.quartz.plugin.triggHistory.class = org.quartz.plugins.history.LoggingJobHistoryPlugin

org.quartz.plugin.jobInitializer.class = org.quartz.plugins.xml.XMLSchedulingDataProcessorPlugin
org.quartz.plugin.jobInitializer.fileNames = quartz_data.xml
org.quartz.plugin.jobInitializer.failOnFileNotFound = true
org.quartz.plugin.jobInitializer.scanInterval = 120
org.quartz.plugin.jobInitializer.wrapInUserTransaction = false

 

从标红的代码我们很清楚的看到了他们的不同之处。

 

2、xml文件的不同

1.8版本之前的配置很简单,在这里就不赘述了。下面讲一下1.8版本的配置。

在1.8中的xml文件变化很大,看代码先:

<?xml version="1.0" encoding="UTF-8"?>
<job-scheduling-data
	xmlns="http://www.quartz-scheduler.org/xml/JobSchedulingData"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.quartz-scheduler.org/xml/JobSchedulingData http://www.quartz-scheduler.org/xml/job_scheduling_data_1_8.xsd"
	version="1.8">
	<pre-processing-commands>
        <delete-jobs-in-group>*</delete-jobs-in-group>  <!-- clear all jobs in scheduler -->
        <delete-triggers-in-group>*</delete-triggers-in-group> <!-- clear all triggers in scheduler -->
    </pre-processing-commands>
    
    <processing-directives>
        <!-- if there are any jobs/trigger in scheduler of same name (as in this file), overwrite them -->
        <overwrite-existing-data>true</overwrite-existing-data>
        <!-- if there are any jobs/trigger in scheduler of same name (as in this file), and over-write is false, ignore them rather then generating an error -->
        <ignore-duplicates>false</ignore-duplicates> 
    </processing-directives>
	<schedule>
		<job>
			<name>test</name>
			<group>aaa</group>
			<job-class>com.ibm.SimpleJob</job-class>
		</job>
		<trigger>
			<cron>
				<name>cronTest</name>
				<group>ddd</group>
				<job-name>test</job-name>
				<job-group>aaa</job-group>
				<cron-expression>0/5 * * * * ?</cron-expression>
			</cron>
		</trigger>
	</schedule>
</job-scheduling-data>

 文档结构和文档属性都有很大的不同,不要再哪1.6 的配置来用了。

但是 ,我们又不想升级原先系统的配置怎么办呢?

quartz也给我们想到了,只需要下载一个旧版本兼容包即可(可到附件下载)。

你可能感兴趣的:(xml,quartz,配置管理,IBM)