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