您的位置:首页 > 编程语言 > Java开发

spring 配置quartz

2017-01-09 00:00 483 查看
quartz.properties

#==============================================================
#Configure Main Scheduler Properties
#==============================================================
org.quartz.scheduler.instanceName = GameManagerQuartzScheduler
org.quartz.scheduler.instanceId = AUTO

#==============================================================
#Configure JobStore
#==============================================================
org.quartz.jobStore.class =org.quartz.impl.jdbcjobstore.JobStoreTX
#org.quartz.jobStore.driverDelegateClass =org.quartz.impl.jdbcjobstore.StdJDBCDelegate
org.quartz.jobStore.driverDelegateClass =org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
org.quartz.jobStore.misfireThreshold =60000
org.quartz.jobStore.tablePrefix=MQTZ_
org.quartz.jobStore.maxMisfiresToHandleAtATime=10
org.quartz.jobStore.isClustered =true
org.quartz.jobStore.clusterCheckinInterval =15000

#==============================================================
#Configure ThreadPool
#==============================================================
org.quartz.threadPool.class= org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount= 10
org.quartz.threadPool.threadPriority= 5
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread= true

#==============================================================
#Skip Check Update
#update:true
#not update:false
#==============================================================
org.quartz.scheduler.skipUpdateCheck = true

#============================================================================
# Configure Plugins
#============================================================================
org.quartz.plugin.triggHistory.class = org.quartz.plugins.history.LoggingJobHistoryPlugin
org.quartz.plugin.shutdownhook.class = org.quartz.plugins.management.ShutdownHookPlugin
org.quartz.plugin.shutdownhook.cleanShutdown = true

xml配置文件

<!--方式一:统计每局比赛的投注情况  每5分钟执行一次-->
<bean id="matchDetailBetStatJob"
class="org.springframework.scheduling.quartz.JobDetailFactoryBean">
<property name="jobClass"
value="com.hhly.game.manager.job.MatchDetailBetStatJob"></property>
<property name="durability" value="true" />
<property name="requestsRecovery" value="true" />
</bean>
<!--方式一:统计每局比赛的投注情况  每5分钟执行一次-->

<bean id="matchDetailBetStatJobTiggerBean"
class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail" ref="matchDetailBetStatJob"></property>
<property name="cronExpression" value="0 */5 * * * ?"></property>
</bean>

<task:executor id="threadPoolTaskExecutor" pool-size="5" />
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="jobFactory">
<bean class="org.springframework.scheduling.quartz.SpringBeanJobFactory" />
</property>
<property name="dataSource" ref="dataSource" />
<property name="configLocation" value="classpath:quartz.properties" />
<property name="applicationContextSchedulerContextKey" value="applicationContextKey" />
<property name="startupDelay" value="0" />
<property name="overwriteExistingJobs" value="true" />
<property name="exposeSchedulerInRepository" value="true" />
<property name="taskExecutor" ref="threadPoolTaskExecutor" />
<property name="triggers">
<list>
<ref bean="matchDetailBetStatJobTiggerBean" />
</list>
</property>
</bean>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  spring quartz