当前位置: 首页>>代码示例>>Java>>正文


Java StdSchedulerFactory.initialize方法代码示例

本文整理汇总了Java中org.quartz.impl.StdSchedulerFactory.initialize方法的典型用法代码示例。如果您正苦于以下问题:Java StdSchedulerFactory.initialize方法的具体用法?Java StdSchedulerFactory.initialize怎么用?Java StdSchedulerFactory.initialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.quartz.impl.StdSchedulerFactory的用法示例。


在下文中一共展示了StdSchedulerFactory.initialize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doStartup

import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
/**
 * Starts up this event scheduler.
 */
@Override
public void doStartup() {
    try {
        Properties props = new Properties();
        props.put(StdSchedulerFactory.PROP_SCHED_INSTANCE_NAME, getName());
        props.put(StdSchedulerFactory.PROP_SCHED_INSTANCE_ID, getName());
        props.put(StdSchedulerFactory.PROP_THREAD_POOL_CLASS, SimpleThreadPool.class.getName());

        // There should be only one thread here to ensure the proper order of scheduled events.
        props.put(PROP_THREAD_COUNT, Integer.toString(1));

        StdSchedulerFactory schedulerFactory = new StdSchedulerFactory();
        schedulerFactory.initialize(props);

        scheduler = schedulerFactory.getScheduler();
        scheduler.start();
    } catch (SchedulerException e) {
        throw SpongeUtils.wrapException(getName(), e);
    }
}
 
开发者ID:softelnet,项目名称:sponge,代码行数:24,代码来源:QuartzEventScheduler.java

示例2: DefaultTaskScheduler

import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
public DefaultTaskScheduler() {
	StdSchedulerFactory schedFactory = new StdSchedulerFactory();
	Properties props = new Properties();
	props.setProperty("org.quartz.scheduler.instanceName", "DefaultQuartzScheduler");
	props.setProperty("org.quartz.scheduler.rmi.export", "false");
	props.setProperty("org.quartz.scheduler.rmi.proxy", "false");
       props.setProperty("org.quartz.scheduler.wrapJobExecutionInUserTransaction", "false");
       props.setProperty("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool");
       props.setProperty("org.quartz.threadPool.threadCount", "10");
       props.setProperty("org.quartz.jobStore.misfireThreshold", "60000");
       props.setProperty("org.quartz.jobStore.class", "org.quartz.simpl.RAMJobStore");
	try {
		schedFactory.initialize(props);
		quartz = schedFactory.getScheduler();
	} catch (SchedulerException e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:19,代码来源:DefaultTaskScheduler.java

示例3: newScheduler

import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
protected Scheduler newScheduler()throws SchedulerException{
	StdSchedulerFactory factory=new StdSchedulerFactory();
	Properties mergedProps = new Properties();
	mergedProps.setProperty(StdSchedulerFactory.PROP_THREAD_POOL_CLASS, SimpleThreadPool.class.getName());
	mergedProps.setProperty("org.quartz.scheduler.instanceName", "BDF2Scheduler");
	mergedProps.setProperty("org.quartz.scheduler.instanceId", "CoreBDF2Scheduler");
	mergedProps.setProperty("org.quartz.scheduler.makeSchedulerThreadDaemon", makeSchedulerThreadDaemon);
	mergedProps.setProperty("org.quartz.threadPool.threadCount", Integer.toString(threadCount));
	if (this.configLocation != null) {
		try {
			PropertiesLoaderUtils.fillProperties(mergedProps, this.configLocation);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	factory.initialize(mergedProps);
	Scheduler scheduler=factory.getScheduler();
	Collection<JobExecutionListener> jobListeners = this.getApplicationContext().getBeansOfType(JobExecutionListener.class).values();
	for(JobExecutionListener jobListener:jobListeners){
		jobListener.setSessionFactory(getSessionFactory());
		scheduler.getListenerManager().addJobListener(jobListener);
	}
	return scheduler;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:25,代码来源:SchedulerServiceImpl.java

示例4: init

import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
public void init(int port){
	log.info("init begin");
	try {
		StdSchedulerFactory stdSchedulerFactory = new StdSchedulerFactory();
		stdSchedulerFactory.initialize("zeusQuartz.properties");
		scheduler = stdSchedulerFactory.getScheduler();
		scheduler.start();
	} catch (SchedulerException e) {
		ScheduleInfoLog.error("schedule start fail", e);
	}
	dispatcher=new Dispatcher();
	handler=new MasterHandler(this);
	server=new MasterServer(handler);
	server.start(port);
	master=new Master(this);
	log.info("init finish");
}
 
开发者ID:ctripcorp,项目名称:dataworks-zeus,代码行数:18,代码来源:MasterContext.java

示例5: initInternal

import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
protected void initInternal() {
	try {
		StdSchedulerFactory factory = new StdSchedulerFactory();
		factory.initialize(QUARTZ_PROPERTY_FILE_NAME);

		scheduler = factory.getScheduler();

		// Register job listener to bound request context to every job
		// execution
		scheduler.getListenerManager().addJobListener(jobListener, EverythingMatcher.allJobs());
		// Replace default job factory
		scheduler.setJobFactory(jobFactory);
	} catch (SchedulerException ex) {
		throw new IllegalStateException("Failed to initialize Quartz scheduler manager", ex);
	}

	log.info("Quartz scheduler manager initialized");
}
 
开发者ID:GluuFederation,项目名称:oxCore,代码行数:19,代码来源:QuartzSchedulerManager.java

示例6: startup

import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
public static Scheduler startup(Properties props) throws SchedulerException {

        String schedname = props.getProperty(StdSchedulerFactory.PROP_SCHED_INSTANCE_NAME, "QuartzScheduler");
        SchedulerRepository schedRep = SchedulerRepository.getInstance();
        Scheduler scheduler = schedRep.lookup(schedname);
        if (scheduler == null || scheduler.isShutdown()) {
            logger.info("Initializing Scheduler...");
            StdSchedulerFactory factory = new StdSchedulerFactory();
            factory.initialize(props);
            scheduler = factory.getScheduler();
            logger.info("Scheduler has been initialized...");
            
            return scheduler;
        } else {
            throw new SchedulerException(MessageFormat.format("Scheduler with name \"{0}\" already exists. Choose a different name.", schedname));
        }
    }
 
开发者ID:adrianromero,项目名称:taskexecutor,代码行数:18,代码来源:SchedulerInitializer.java

示例7: initScheduler

import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
private void initScheduler(boolean activated) {
	logger.debug("initScheduler - START");
	if (!activated) {
		logger.error("Scheduler deactivated !");
		return;
	}
	
       try {
		// create scheduler
       	StdSchedulerFactory sf = new StdSchedulerFactory();
       	ClassLoader loader = this.getClass().getClassLoader();
       	sf.initialize(loader.getResourceAsStream(ConfigParametersProvider.getString("config", IConstant.SCHEDULER_CONFIG_FILE_LOCATION)));
        Scheduler sched = sf.getScheduler();
		sched.start();
		logger.info("Scheduler started!");
		CMContext.storeOnContext(IConstant.SCHEDULER, sched);
       } catch (SchedulerException e) {
		logger.error("", e);
	}
       
	logger.debug("initScheduler - END");
}
 
开发者ID:CodeSphere,项目名称:termitaria,代码行数:23,代码来源:InitApplication.java

示例8: initScheduler

import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
private void initScheduler(boolean activated) {
	logger.debug("initScheduler - START");
	if (!activated) {
		logger.error("Scheduler deactivated !");
		return;
	}
	
       try {
		// create scheduler
       	StdSchedulerFactory sf = new StdSchedulerFactory();
       	ClassLoader loader = this.getClass().getClassLoader();
       	sf.initialize(loader.getResourceAsStream(ConfigParametersProvider.getString("business", IConstant.SCHEDULER_CONFIG_FILE_LOCATION)));
        Scheduler sched = sf.getScheduler();
		sched.start();
		logger.info("Scheduler started!");
		OMContext.storeOnContext(IConstant.SCHEDULER, sched);
       } catch (SchedulerException e) {
		logger.error("", e);
	}
	logger.debug("initScheduler - END");
}
 
开发者ID:CodeSphere,项目名称:termitaria,代码行数:22,代码来源:InitApplication.java

示例9: getScheduler

import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
private Scheduler getScheduler() {
    StdSchedulerFactory factory = new StdSchedulerFactory();
    try {
        factory.initialize(getQuartzProperties());
        return factory.getScheduler();
    } catch (final SchedulerException ex) {
        throw new JobSystemException(ex);
    }
}
 
开发者ID:elasticjob,项目名称:elastic-job-cloud,代码行数:10,代码来源:TransientProducerScheduler.java

示例10: StatisticsScheduler

import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
/**
 * 构造函数.
 */
StatisticsScheduler() {
    factory = new StdSchedulerFactory();
    try {
        factory.initialize(getQuartzProperties());
    } catch (final SchedulerException ex) {
        throw new JobStatisticException(ex);
    }
}
 
开发者ID:elasticjob,项目名称:elastic-job-cloud,代码行数:12,代码来源:StatisticsScheduler.java

示例11: createService

import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
@Override
public void createService() throws Exception {
    log.info("Create QuartzService(" + jndiName + ")...");

    if (error) {
        log
                .error("Must specify only one of 'Properties' or 'PropertiesFile'");

        throw new Exception(
                "Must specify only one of 'Properties' or 'PropertiesFile'");
    }

    schedulerFactory = new StdSchedulerFactory();

    try {
        if (useProperties) {
            schedulerFactory.initialize(properties);
        }

        if (usePropertiesFile) {
            schedulerFactory.initialize(propertiesFile);
        }
    } catch (Exception e) {
        log.error("Failed to initialize Scheduler", e);

        throw new SchedulerConfigException(
                "Failed to initialize Scheduler - ", e);
    }

    log.info("QuartzService(" + jndiName + ") created.");
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:32,代码来源:QuartzService.java

示例12: quartzScheduler

import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
/**
 * Setup quartz scheduler
 */
@Bean
public Scheduler quartzScheduler() {
    try {
        StdSchedulerFactory factory = new StdSchedulerFactory();
        factory.initialize(new ClassPathResource("quartz.properties").getInputStream());
        return factory.getScheduler();
    } catch (SchedulerException | IOException e) {
        throw new IllegalStatusException("Unable to init quartz: " + e.getMessage());
    }
}
 
开发者ID:FlowCI,项目名称:flow-platform,代码行数:14,代码来源:SchedulerConfig.java

示例13: initDetectionScheduler

import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
private void initDetectionScheduler() throws Exception{
	StdSchedulerFactory factory=new StdSchedulerFactory();
	Properties mergedProps = new Properties();
	mergedProps.setProperty(StdSchedulerFactory.PROP_THREAD_POOL_CLASS, SimpleThreadPool.class.getName());
	mergedProps.setProperty("org.quartz.scheduler.instanceName", "BDF2HeartbeatScheduler");
	mergedProps.setProperty("org.quartz.scheduler.instanceId", "HeartbeatDetectionScheduler");
	mergedProps.setProperty("org.quartz.threadPool.threadCount","1");
	factory.initialize(mergedProps);
	scheduler=factory.getScheduler();
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:11,代码来源:InstanceDetection.java

示例14: initDetectionScheduler

import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
private void initDetectionScheduler() throws Exception{
	StdSchedulerFactory factory=new StdSchedulerFactory();
	Properties mergedProps = new Properties();
	mergedProps.setProperty(StdSchedulerFactory.PROP_THREAD_POOL_CLASS, SimpleThreadPool.class.getName());
	mergedProps.setProperty("org.quartz.scheduler.makeSchedulerThreadDaemon", "true");
	mergedProps.setProperty("org.quartz.scheduler.instanceName", "UfloClusterHeartbeatScheduler");
	mergedProps.setProperty("org.quartz.scheduler.instanceId", "UfloHeartbeatDetectionScheduler");
	mergedProps.setProperty("org.quartz.threadPool.threadCount","2");
	factory.initialize(mergedProps);
	scheduler=factory.getScheduler();
}
 
开发者ID:youseries,项目名称:uflo,代码行数:12,代码来源:InstanceDetection.java

示例15: initScheduler

import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
protected void initScheduler(Properties properties) {
    this.properties = properties;
    try {
        StdSchedulerFactory schedulerFactory = new StdSchedulerFactory();
        schedulerFactory.initialize(properties);
        scheduler = schedulerFactory.getScheduler();
        scheduler.start();
    } catch (SchedulerException e) {
        LoggerHelper.error("create scheduler failed.", e);
        throw new NiubiException(e);
    }
}
 
开发者ID:xiaolongzuo,项目名称:niubi-job,代码行数:13,代码来源:AbstractScheduleManager.java


注:本文中的org.quartz.impl.StdSchedulerFactory.initialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。