Quartz的集群模式和单机模式共存-让一个非集群的Quartz与集群节点并行着运行

假如你让一个非集群的 Quartz 应用与集群节点并行着运行,设法使用 JobInitializationPlugin和 RAMJobStore

Quartz支持可选节点执行job
quartz集群,会自动将触发的job均衡的分发到各个节点。不过我现在有一个特殊的job,希望触发后可以在每个节点(或是指定的节点)执行。

 

 百度、Google 了半天。。。没找到答案。

后来自己折腾了一天搞定了...

 效果 http://www.cnblogs.com/interdrp/p/4063365.html

StdSchedulerFactory,调用其initialize方法,并且自己定义填写配置内容:

 
1
2
3
4
5
6
7
8

        StdSchedulerFactory sf = new StdSchedulerFactory();

        Properties props = new Properties();
        props.put("org.quartz.scheduler.instanceName", "ReYoQuartzAlone");//必须
        props.put("org.quartz.scheduler.instanceId", "AUTO");
        props.put("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool");
        props.put("org.quartz.threadPool.threadCount", "10");//必须
        props.put("org.quartz.threadPool.threadPriority", "5");
        props.put("org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread", "true");
        sf.initialize(props);
 


转载于:https://www.cnblogs.com/interdrp/p/4067787.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值