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);
 



免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM