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


Java StdSchedulerFactory.getScheduler方法代码示例

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


在下文中一共展示了StdSchedulerFactory.getScheduler方法的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: init

import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
/**
 * Init servlet
 */
public void init(ServletConfig config) throws ServletException {
    super.init(config);
    try {
        schedFact = new StdSchedulerFactory("soa_quartz.properties");
        sched = schedFact.getScheduler();
        System.out.println(this.getClass().getName() + " started");
        sched.start();

        // Create Master Dispatch job
        JobDetail jd = new JobDetail(MASTER_JOB_NAME, GROUP_NAME, MasterSOAJob.class);
        int repeatInterval = Integer.parseInt(getInitParameter("TRIGGER_REPEATINTERVAL"));
        System.out.println(this.getClass().getName() + " Repeat interval for " + MASTER_JOB_NAME + ": " + repeatInterval + " milliseconds");
        SimpleTrigger simpleTrigger = new SimpleTrigger(MASTER_TRIGGER_NAME, GROUP_NAME, SimpleTrigger.REPEAT_INDEFINITELY, repeatInterval);
        System.out.println(this.getClass().getName() + " Scheduling Job " + MASTER_JOB_NAME);
        sched.scheduleJob(jd, simpleTrigger);
        System.out.println(this.getClass().getName() + " Job " + MASTER_JOB_NAME + " scheduled");

    } catch (Exception e) {
        System.err.println(this.getClass().getName() + " " + e.getLocalizedMessage());
        e.printStackTrace(System.err);
    }
}
 
开发者ID:eliasgranderubio,项目名称:pfm-mustic9,代码行数:26,代码来源:MasterSOASchedulerServlet.java

示例6: 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

示例7: 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

示例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("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

示例9: 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

示例10: startScheduler

import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
/**
 * The init method is called when this plugin is initialized
 * <P>
 * @param actionServlet The struts ActionServlet
 * @param moduleConfig The struts ModuleConfig
 */
public static void startScheduler(ServletContext context)
{
	  // The Quartz Scheduler
	  Scheduler scheduler = null;

	  // Retrieve the factory from the ServletContext.
	  // It will be put there by the Quartz Servlet
	  StdSchedulerFactory factory = (StdSchedulerFactory) 
	      context.getAttribute(QuartzInitializerServlet.QUARTZ_FACTORY_KEY);
	    
	  try
	  {
	        // Retrieve the scheduler from the factory
	        scheduler = factory.getScheduler();
	        scheduler.start();
	  }
	  catch (Exception e)
	  {
	     logger.error("Error setting up scheduler: " + e.getMessage());
	  }
	  
	  sm_scheduler = scheduler;
}
 
开发者ID:NCIP,项目名称:rembrandt,代码行数:30,代码来源:StatisticsInfoPlugIn.java

示例11: 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

示例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: start

import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
@Override
public void start(String resource) throws Throwable {
	log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
	log.info("timer client component starting, version: " + Version.getVersion());
	log.info("*** Start parsing: " + resource);
	parse(resource);// "config.xml"
	schedulerfactory = new StdSchedulerFactory();
	scheduler = schedulerfactory.getScheduler();
	register();
	scheduler.start();
	log.info("timer client component successfully.");
}
 
开发者ID:xsonorg,项目名称:tangyuan2,代码行数:13,代码来源:TimerComponent.java

示例14: instantiateSchedulerFactory

import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
/**
 * <p>
 * Initialize the <code>{@link org.quartz.SchedulerFactory}</code> with the
 * contents of the given <code>Properties</code> object.
 * </p>
 */
public void instantiateSchedulerFactory() {
  final StdSchedulerFactory factory = new StdSchedulerFactory();
  try {
    scheduler = factory.getScheduler();
  } catch (SchedulerException e) {
    LOGGER.error(INITIALIZE_ERROR, e);
  }
}
 
开发者ID:jaffa-projects,项目名称:jaffa-framework,代码行数:15,代码来源:QuartzSchedulerHelper.java

示例15: KairosDBSchedulerImpl

import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
@Inject
public KairosDBSchedulerImpl(Injector guice) throws SchedulerException
{
	this.guice = guice;

	Properties props = new Properties();
	props.setProperty("org.quartz.threadPool.threadCount", "4");
	props.setProperty(StdSchedulerFactory.PROP_SCHED_SKIP_UPDATE_CHECK, "true");

	StdSchedulerFactory factory = new StdSchedulerFactory(props);
	scheduler = factory.getScheduler();
	scheduler.setJobFactory(new KairosDBJobFactory(guice));
}
 
开发者ID:quqiangsheng,项目名称:abhot,代码行数:14,代码来源:KairosDBSchedulerImpl.java


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