码迷,mamicode.com
首页 > 其他好文 > 详细

ScheduleFactory(不同scheduler name)

时间:2017-04-24 15:33:00      阅读:142      评论:0      收藏:0      [点我收藏+]

标签:tor   exce   pre   factory   content   ini   create   article   member   

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)

标签:tor   exce   pre   factory   content   ini   create   article   member   

原文地址:http://www.cnblogs.com/blfbuaa/p/6756823.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!