當前位置: 首頁>>代碼示例>>Java>>正文


Java SchedulerFactoryBean.setJobFactory方法代碼示例

本文整理匯總了Java中org.springframework.scheduling.quartz.SchedulerFactoryBean.setJobFactory方法的典型用法代碼示例。如果您正苦於以下問題:Java SchedulerFactoryBean.setJobFactory方法的具體用法?Java SchedulerFactoryBean.setJobFactory怎麽用?Java SchedulerFactoryBean.setJobFactory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.scheduling.quartz.SchedulerFactoryBean的用法示例。


在下文中一共展示了SchedulerFactoryBean.setJobFactory方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: schedulerFactory

import org.springframework.scheduling.quartz.SchedulerFactoryBean; //導入方法依賴的package包/類
@Bean
public SchedulerFactoryBean schedulerFactory(JobFactory jobFactory) {
    SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean();
    schedulerFactoryBean.setApplicationContext(applicationContext);
    schedulerFactoryBean.setAutoStartup(schedulerProperties.isAutoStartup());
    schedulerFactoryBean.setDataSource(dataSource);
    schedulerFactoryBean.setTransactionManager(platformTransactionManager);
    schedulerFactoryBean.setOverwriteExistingJobs(schedulerProperties.isOverwriteExistingJobs());
    schedulerFactoryBean.setSchedulerFactoryClass(StdSchedulerFactory.class);
    schedulerFactoryBean.setBeanName(schedulerProperties.getBeanName());
    schedulerFactoryBean.setJobFactory(jobFactory);
    schedulerFactoryBean.setWaitForJobsToCompleteOnShutdown(schedulerProperties.isWaitOnShutdown());
    schedulerFactoryBean.setQuartzProperties(schedulerProperties.getProperties());
    schedulerFactoryBean.setStartupDelay(schedulerProperties.getStartupDelay());
    schedulerFactoryBean.setCalendars(calendarMap);
    schedulerFactoryBean.setSchedulerListeners(schedulerListeners);
    return schedulerFactoryBean;
}
 
開發者ID:hs-web,項目名稱:hsweb-framework,代碼行數:19,代碼來源:ScheduleAutoConfiguration.java

示例2: schedulerFactoryBean

import org.springframework.scheduling.quartz.SchedulerFactoryBean; //導入方法依賴的package包/類
/**
 * create scheduler
 */
@Bean
public SchedulerFactoryBean schedulerFactoryBean() throws IOException {
 
    SchedulerFactoryBean factory = new SchedulerFactoryBean();
    factory.setOverwriteExistingJobs(true);
    factory.setDataSource(dataSource);
    factory.setQuartzProperties(quartzProperties());
    
    //Register listeners to get notification on Trigger misfire etc
    factory.setGlobalTriggerListeners(triggerListner);
    factory.setGlobalJobListeners(jobsListener);
    
    AutowiringSpringBeanJobFactory jobFactory = new AutowiringSpringBeanJobFactory();
    jobFactory.setApplicationContext(applicationContext);
    factory.setJobFactory(jobFactory);
    
    return factory;
}
 
開發者ID:javabypatel,項目名稱:spring-boot-quartz-demo,代碼行數:22,代碼來源:QuartzSchedulerConfig.java

示例3: schedulerFactoryBean

import org.springframework.scheduling.quartz.SchedulerFactoryBean; //導入方法依賴的package包/類
@Bean(name = "batch")
    public SchedulerFactoryBean schedulerFactoryBean(
    		DataSource dataSource, 
    		JobFactory jobFactory) {
        SchedulerFactoryBean factory = new SchedulerFactoryBean();
        factory.setOverwriteExistingJobs(true);
        factory.setDataSource(dataSource);
        factory.setJobFactory(jobFactory);
        
        Properties props = new Properties();
        props.setProperty(StdSchedulerFactory.PROP_SCHED_INSTANCE_NAME, "batch");
        props.setProperty(StdSchedulerFactory.PROP_SCHED_INSTANCE_ID, "auto");
        props.setProperty("org.quartz.jobStore.driverDelegateClass", "org.quartz.impl.jdbcjobstore.HSQLDBDelegate");
        props.setProperty("org.quartz.scheduler.skipUpdateCheck", "true");
//        factory.setQuartzProperties(props);
//        factory.setTriggers(sampleJobTrigger);

        return factory;
    }
 
開發者ID:mow811236,項目名稱:sample-schedule-job-admin,代碼行數:20,代碼來源:Quartz.java

示例4: schedulerFactoryBean

import org.springframework.scheduling.quartz.SchedulerFactoryBean; //導入方法依賴的package包/類
@Bean
public SchedulerFactoryBean schedulerFactoryBean(
        DataSource dataSource, PlatformTransactionManager transactionManager, JobFactory jobFactory) {

    final SchedulerFactoryBean factory = new SchedulerFactoryBean();
    factory.setOverwriteExistingJobs(true);
    factory.setTaskExecutor(commonTaskScheduler.getScheduledExecutor());
    factory.setDataSource(dataSource);
    factory.setTransactionManager(transactionManager);
    factory.setJobFactory(jobFactory);
    factory.setQuartzProperties(quartzProperties);
    factory.setSchedulerName(SCHEDULER_NAME);
    factory.setAutoStartup(true);
    factory.setWaitForJobsToCompleteOnShutdown(true);

    // Delay added to avoid errors caused by updating registered tasks and reduce load on startup
    factory.setStartupDelay(30);

    return factory;
}
 
開發者ID:suomenriistakeskus,項目名稱:oma-riista-web,代碼行數:21,代碼來源:QuartzConfig.java

示例5: schedulerFactory

import org.springframework.scheduling.quartz.SchedulerFactoryBean; //導入方法依賴的package包/類
@Bean
public SchedulerFactoryBean schedulerFactory(JobFactory jobFactory) throws IOException {
    SchedulerFactoryBean factory = new SchedulerFactoryBean();
    factory.setSchedulerName("Sentry");
    factory.setJobFactory(jobFactory);
    factory.setQuartzProperties(quartzProperties());
    // this allows to update triggers in DB when updating settings in config file:
    factory.setOverwriteExistingJobs(true);
    return factory;
}
 
開發者ID:quanticc,項目名稱:sentry,代碼行數:11,代碼來源:SchedulerConfiguration.java

示例6: schedulerFactoryBean

import org.springframework.scheduling.quartz.SchedulerFactoryBean; //導入方法依賴的package包/類
@Bean
public SchedulerFactoryBean schedulerFactoryBean(ApplicationContext applicationContext, DataSource dataSource,
		JobFactory jobFactory)
{
	SchedulerFactoryBean schedulerFactory = new SchedulerFactoryBean();
	schedulerFactory.setConfigLocation(new ClassPathResource("quartz.properties"));
	schedulerFactory.setAutoStartup(true);
	schedulerFactory.setDataSource(dataSource);
	schedulerFactory.setJobFactory(jobFactory);
	return schedulerFactory;
}
 
開發者ID:yonadev,項目名稱:yona-server,代碼行數:12,代碼來源:QuartzConfig.java

示例7: schedulerFactory

import org.springframework.scheduling.quartz.SchedulerFactoryBean; //導入方法依賴的package包/類
@Bean
public SchedulerFactoryBean schedulerFactory(ApplicationContext applicationContext) {
	SchedulerFactoryBean factoryBean = new SchedulerFactoryBean();
	AutowiringSpringBeanJobFactory jobFactory = new AutowiringSpringBeanJobFactory();
	jobFactory.setApplicationContext(applicationContext);
	
	factoryBean.setJobFactory(jobFactory);
	factoryBean.setApplicationContextSchedulerContextKey("applicationContext");
	return factoryBean;
}
 
開發者ID:juliuskrah,項目名稱:quartz-manager,代碼行數:11,代碼來源:Application.java

示例8: mainScheduler

import org.springframework.scheduling.quartz.SchedulerFactoryBean; //導入方法依賴的package包/類
@Bean(name = "mainScheduler")
public SchedulerFactoryBean mainScheduler(DelegatingQuartzJobFactory jobFactory,
                                            @Qualifier("quartzProperties") Properties quartzProperties,
                                            @Value("#{'${cronyx.passive}'=='true'}") boolean passive,
                                            @Qualifier("cronyxDataSource") DataSource dataSource){
    SchedulerFactoryBean factory = new SchedulerFactoryBean();
    factory.setJobFactory(jobFactory);
    factory.setQuartzProperties(quartzProperties);
    factory.setDataSource(dataSource);
    factory.setAutoStartup(!passive);
    factory.setSchedulerName(quartzProperties.getProperty(PROP_SCHED_INSTANCE_NAME));
    return factory;
}
 
開發者ID:taboola,項目名稱:taboola-cronyx,代碼行數:14,代碼來源:CronyxAutoConfiguration.java

示例9: schedulerFactoryBean

import org.springframework.scheduling.quartz.SchedulerFactoryBean; //導入方法依賴的package包/類
@Bean
public SchedulerFactoryBean schedulerFactoryBean() {
    SchedulerFactoryBean scheduler = new SchedulerFactoryBean();
    scheduler.setTaskExecutor(getAsyncExecutor());
    scheduler.setAutoStartup(true);
    scheduler.setJobFactory(new SimpleJobFactory());
    return scheduler;
}
 
開發者ID:hortonworks,項目名稱:cloudbreak,代碼行數:9,代碼來源:AppConfig.java

示例10: schedulerFactoryBean

import org.springframework.scheduling.quartz.SchedulerFactoryBean; //導入方法依賴的package包/類
@Bean
public SchedulerFactoryBean schedulerFactoryBean()
{
	SchedulerFactoryBean quartzScheduler = new SchedulerFactoryBean();
	AutowiringSpringBeanJobFactory jobFactory = new AutowiringSpringBeanJobFactory();
	jobFactory.setApplicationContext(applicationContext);
	quartzScheduler.setJobFactory(jobFactory);
	return quartzScheduler;
}
 
開發者ID:molgenis,項目名稱:molgenis,代碼行數:10,代碼來源:SchedulerConfig.java

示例11: quartzScheduler

import org.springframework.scheduling.quartz.SchedulerFactoryBean; //導入方法依賴的package包/類
@Bean
public Scheduler quartzScheduler(ApplicationContext context) throws Exception {
    SchedulerFactoryBean factory = new SchedulerFactoryBean();

    factory.setApplicationContext(context);
    factory.setExposeSchedulerInRepository(true);
    factory.setApplicationContextSchedulerContextKey(APPLICATION_CONTEXT_KEY);
    factory.setJobFactory(glassJobFactory);

    Properties properties = new Properties();
    properties.setProperty("org.quartz.scheduler.skipUpdateCheck","true");
    properties.setProperty("org.quartz.threadPool.class", SimpleThreadPool.class.getName());
    properties.setProperty("org.quartz.threadPool.threadCount", "15");
    properties.setProperty("org.quartz.threadPool.threadPriority", "4");

    if (configuration().isInMemory()) {
        properties.setProperty("org.quartz.jobStore.class", RAMJobStore.class.getName());
    } else {
        factory.setDataSource(dataSource());

        properties.setProperty("org.quartz.jobStore.tablePrefix", configuration().getTablePrefix());
        properties.setProperty("org.quartz.jobStore.isClustered", "false");
        properties.setProperty("org.quartz.jobStore.driverDelegateClass", configuration().getDriverDelegateClass());
    }

    factory.setQuartzProperties(properties);

    factory.afterPropertiesSet();

    Scheduler scheduler = factory.getObject();

    scheduler.getListenerManager().addJobListener(glassJobListener);
    scheduler.getListenerManager().addSchedulerListener(glassSchedulerListener);

    scheduler.start();

    return scheduler;
}
 
開發者ID:bingoohuang,項目名稱:quartz-glass,代碼行數:39,代碼來源:SpringConfig.java

示例12: scheduler

import org.springframework.scheduling.quartz.SchedulerFactoryBean; //導入方法依賴的package包/類
@Bean
public Scheduler scheduler() throws Exception {
	SchedulerFactoryBean factory = new SchedulerFactoryBean();
	factory.setTriggers(new Trigger[] { jobDetailTrigger() });
	factory.setJobFactory(new SpringBeanJobFactory());
	factory.setDataSource(dataSource());
	factory.setSchedulerContextAsMap(new HashMap<String, Object>() {{
		put("job", job());
		put("jobLauncher", jobLauncher);
	}});
	factory.afterPropertiesSet();

	return factory.getObject();
}
 
開發者ID:debop,項目名稱:spring-batch-experiments,代碼行數:15,代碼來源:QuartzSchedulingConfiguration.java

示例13: autoSchedulerFactory

import org.springframework.scheduling.quartz.SchedulerFactoryBean; //導入方法依賴的package包/類
@Bean(name = QUARTZ_SCHEDULER_FACTORY_BEAN_NAME)
@ConditionalOnMissingBean(name = QUARTZ_SCHEDULER_FACTORY_BEAN_NAME)
public SchedulerFactoryBean autoSchedulerFactory(ApplicationContext applicationContext, JobFactory jobFactory,
		QuartzSchedulerProperties properties, @Qualifier(QUARTZ_PROPERTIES_BEAN_NAME) Properties quartzProperties) {
	
	LOGGER.debug("creating SchedulerFactory");
	
	SchedulerFactoryBean factory = BeanUtils.instantiateClass(SchedulerFactoryBean.class);
	
       factory.setApplicationContext(applicationContext);
       factory.setJobFactory(jobFactory);
       
       Persistence persistenceSettings = properties.getPersistence();
       if (persistenceSettings.isPersisted()) {
       	factory.setDataSource(getDataSource(applicationContext, persistenceSettings));
       	if (persistenceSettings.isUsePlatformTxManager()) {
       		PlatformTransactionManager txManager = getTransactionManager(applicationContext);
           	if (null != txManager) {
               	factory.setTransactionManager(txManager);
               }
       	}
       }
       
       SchedulerFactory factorySettings = properties.getSchedulerFactory();
       factory.setSchedulerName(factorySettings.getSchedulerName());
       factory.setPhase(factorySettings.getPhase());
       factory.setStartupDelay(factorySettings.getStartupDelay());
       factory.setAutoStartup(factorySettings.isAutoStartup());
       factory.setWaitForJobsToCompleteOnShutdown(factorySettings.isWaitForJobsToCompleteOnShutdown());
       factory.setOverwriteExistingJobs(factorySettings.isOverwriteExistingJobs());
       factory.setExposeSchedulerInRepository(factorySettings.isExposeSchedulerInRepository());
       
       factory.setQuartzProperties(quartzProperties);
       
       Collection<Trigger> triggers = getTriggers(applicationContext);
       if (null != triggers && !triggers.isEmpty()) {
       	factory.setTriggers(triggers.toArray(new Trigger[triggers.size()]));
       	LOGGER.info("staring scheduler factory with " + triggers.size() + " job triggers");
       } else {
       	LOGGER.info("staring scheduler factory with 0 job triggers");
       }
       
       QuartzSchedulerFactoryOverrideHook hook = getQuartzSchedulerFactoryOverrideHook(applicationContext);
       if (null != hook) {
       	factory = hook.override(factory, properties, quartzProperties);
       }
       
	return factory;
}
 
開發者ID:andrehertwig,項目名稱:spring-boot-starter-quartz,代碼行數:50,代碼來源:QuartzSchedulerAutoConfiguration.java


注:本文中的org.springframework.scheduling.quartz.SchedulerFactoryBean.setJobFactory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。