ScheduleFactory(不同scheduler name)
Posted blfbuaa
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ScheduleFactory(不同scheduler name)相关的知识,希望对你有一定的参考价值。
package com.unis.uvm.quartz; import java.util.Properties; import org.quartz.Scheduler; import org.quartz.SchedulerException; import org.quartz.impl.StdSchedulerFactory; /** * Scheduler Factory: used to create a scheduler * * @author xpz * @version [version, Nov 17, 2014] * @see [about class/method] * @since [product/module version] */ public class ScheduleFactory { private static Scheduler scheduler = null; private ScheduleFactory() { } /*** * get scheduler instance * * @return [explain parameter] * @return Scheduler [explain return type] * @throws SchedulerException * @exception throws [exception type] [explain exception] * @see [class,class#method,class#member] */ public static Scheduler getScheduler(String threadName) throws SchedulerException { if (scheduler == null) { StdSchedulerFactory sf = new StdSchedulerFactory( "quartz.properties"); Properties pros = new Properties(); pros.put("org.quartz.scheduler.instanceName", threadName); pros.put("org.quartz.threadPool.threadCount", "10"); sf.initialize(pros); scheduler = sf.getScheduler(); } return scheduler; } }
以上是关于ScheduleFactory(不同scheduler name)的主要内容,如果未能解决你的问题,请参考以下文章
Spring @Scheduled定时任务的fixedRate,fixedDelay,cron的作用和不同
Apache Storm中的Scheduler和Strategy之间有什么不同
Quartz 和 springboot schedule中的cron表达式关于星期(周几)的不同表示