spring+quartz项目,让一个quartz实例不执行。

本文介绍了一种方法来禁用Tomcat集群环境下特定服务器上的Quartz定时任务。通过修改quartz.properties文件配置,可以使得某个Quartz实例不执行任务。具体配置包括使用自定义的线程池实现,将线程池大小设置为0。


最近有个项目,用到了tomcat集群。

有需求,让quartz定时任务在某台服务器上不跑。于是一番搜索加询问,终于找到了解决方案。

quartz.properties 实现让一个quartz实例不执行。

# add org.quartz.threadExecutor.class
org.quartz.threadExecutor.class = com.xxx.job.service.impl.DryRunThreadExcutor
#org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.class = com.xxx.job.service.impl.MyZeroSizeThreadPool
#org.quartz.threadPool.threadCount = 10
org.quartz.threadPool.threadCount = 0
#org.quartz.threadPool.threadPriority = 5
#org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread = true




参考文档:http://ju.outofmemory.cn/entry/203356



评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值