• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java SchedulerRepository类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.quartz.impl.SchedulerRepository的典型用法代码示例。如果您正苦于以下问题:Java SchedulerRepository类的具体用法?Java SchedulerRepository怎么用?Java SchedulerRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SchedulerRepository类属于org.quartz.impl包,在下文中一共展示了SchedulerRepository类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: findScheduler

import org.quartz.impl.SchedulerRepository; //导入依赖的package包/类
protected Scheduler findScheduler(String schedulerName) throws SchedulerException {
	if (this.beanFactory instanceof ListableBeanFactory) {
		ListableBeanFactory lbf = (ListableBeanFactory) this.beanFactory;
		String[] beanNames = lbf.getBeanNamesForType(Scheduler.class);
		for (String beanName : beanNames) {
			Scheduler schedulerBean = (Scheduler) lbf.getBean(beanName);
			if (schedulerName.equals(schedulerBean.getSchedulerName())) {
				return schedulerBean;
			}
		}
	}
	Scheduler schedulerInRepo = SchedulerRepository.getInstance().lookup(schedulerName);
	if (schedulerInRepo == null) {
		throw new IllegalStateException("No Scheduler named '" + schedulerName + "' found");
	}
	return schedulerInRepo;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:SchedulerAccessorBean.java


示例2: createScheduler

import org.quartz.impl.SchedulerRepository; //导入依赖的package包/类
/**
 * Create the Scheduler instance for the given factory and scheduler name.
 * Called by {@link #afterPropertiesSet}.
 * <p>The default implementation invokes SchedulerFactory's {@code getScheduler}
 * method. Can be overridden for custom Scheduler creation.
 * @param schedulerFactory the factory to create the Scheduler with
 * @param schedulerName the name of the scheduler to create
 * @return the Scheduler instance
 * @throws SchedulerException if thrown by Quartz methods
 * @see #afterPropertiesSet
 * @see org.quartz.SchedulerFactory#getScheduler
 */
protected Scheduler createScheduler(SchedulerFactory schedulerFactory, String schedulerName)
		throws SchedulerException {

	// Override thread context ClassLoader to work around naive Quartz ClassLoadHelper loading.
	Thread currentThread = Thread.currentThread();
	ClassLoader threadContextClassLoader = currentThread.getContextClassLoader();
	boolean overrideClassLoader = (this.resourceLoader != null &&
			!this.resourceLoader.getClassLoader().equals(threadContextClassLoader));
	if (overrideClassLoader) {
		currentThread.setContextClassLoader(this.resourceLoader.getClassLoader());
	}
	try {
		SchedulerRepository repository = SchedulerRepository.getInstance();
		synchronized (repository) {
			Scheduler existingScheduler = (schedulerName != null ? repository.lookup(schedulerName) : null);
			Scheduler newScheduler = schedulerFactory.getScheduler();
			if (newScheduler == existingScheduler) {
				throw new IllegalStateException("Active Scheduler of name '" + schedulerName + "' already registered " +
						"in Quartz SchedulerRepository. Cannot create a new Spring-managed Scheduler of the same name!");
			}
			if (!this.exposeSchedulerInRepository) {
				// Need to remove it in this case, since Quartz shares the Scheduler instance by default!
				SchedulerRepository.getInstance().remove(newScheduler.getSchedulerName());
			}
			return newScheduler;
		}
	}
	finally {
		if (overrideClassLoader) {
			// Reset original thread context ClassLoader.
			currentThread.setContextClassLoader(threadContextClassLoader);
		}
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:47,代码来源:SchedulerFactoryBean.java


示例3: startup

import org.quartz.impl.SchedulerRepository; //导入依赖的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


示例4: doStop

import org.quartz.impl.SchedulerRepository; //导入依赖的package包/类
@Override
protected void doStop() throws Exception {
  // shutdown and unregister the scheduler instance
  scheduler.shutdown();
  SchedulerRepository.getInstance().remove(SCHEDULER_NAME);
  scheduler = null;
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:8,代码来源:QuartzSchedulerSPI.java


示例5: testSchedulerRepositoryExposure

import org.quartz.impl.SchedulerRepository; //导入依赖的package包/类
@Test
public void testSchedulerRepositoryExposure() throws InterruptedException {
	ClassPathXmlApplicationContext ctx =
			new ClassPathXmlApplicationContext("/org/springframework/scheduling/quartz/schedulerRepositoryExposure.xml");
	assertSame(SchedulerRepository.getInstance().lookup("myScheduler"), ctx.getBean("scheduler"));
	ctx.close();
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:8,代码来源:QuartzSupportTests.java


示例6: getSchedulers

import org.quartz.impl.SchedulerRepository; //导入依赖的package包/类
public static String[] getSchedulers() throws SchedulerException {

        ArrayList<String> l = new ArrayList<String>();
        Collection<Scheduler> schedulers = SchedulerRepository.getInstance().lookupAll();
        for (Scheduler s : schedulers) {
            if (!s.isShutdown()) {
                l.add(s.getSchedulerName());
            }
        }

        return l.toArray(new String [l.size()]);
    }
 
开发者ID:adrianromero,项目名称:taskexecutor,代码行数:13,代码来源:SchedulerInitializer.java


示例7: createScheduler

import org.quartz.impl.SchedulerRepository; //导入依赖的package包/类
/**
 * Create the Scheduler instance for the given factory and scheduler name.
 * Called by {@link #afterPropertiesSet}.
 * <p>The default implementation invokes SchedulerFactory's <code>getScheduler</code>
 * method. Can be overridden for custom Scheduler creation.
 * @param schedulerFactory the factory to create the Scheduler with
 * @param schedulerName the name of the scheduler to create
 * @return the Scheduler instance
 * @throws SchedulerException if thrown by Quartz methods
 * @see #afterPropertiesSet
 * @see org.quartz.SchedulerFactory#getScheduler
 */
protected Scheduler createScheduler(SchedulerFactory schedulerFactory, String schedulerName)
		throws SchedulerException {

	// Override thread shard ClassLoader to work around naive Quartz ClassLoadHelper loading.
	Thread currentThread = Thread.currentThread();
	ClassLoader threadContextClassLoader = currentThread.getContextClassLoader();
	boolean overrideClassLoader = (this.resourceLoader != null &&
			!this.resourceLoader.getClassLoader().equals(threadContextClassLoader));
	if (overrideClassLoader) {
		currentThread.setContextClassLoader(this.resourceLoader.getClassLoader());
	}
	try {
		SchedulerRepository repository = SchedulerRepository.getInstance();
		synchronized (repository) {
			Scheduler existingScheduler = (schedulerName != null ? repository.lookup(schedulerName) : null);
			Scheduler newScheduler = schedulerFactory.getScheduler();
			if (newScheduler == existingScheduler) {
				throw new IllegalStateException("Active Scheduler of name '" + schedulerName + "' already registered " +
						"in Quartz SchedulerRepository. Cannot create a new Spring-managed Scheduler of the same name!");
			}
			if (!this.exposeSchedulerInRepository) {
				// Need to remove it in this case, since Quartz shares the Scheduler instance by default!
				SchedulerRepository.getInstance().remove(newScheduler.getSchedulerName());
			}
			return newScheduler;
		}
	}
	finally {
		if (overrideClassLoader) {
			// Reset original thread shard ClassLoader.
			currentThread.setContextClassLoader(threadContextClassLoader);
		}
	}
}
 
开发者ID:yamingd,项目名称:argo,代码行数:47,代码来源:TaskSchedulerFactory.java


示例8: schedulerRepositoryExposure

import org.quartz.impl.SchedulerRepository; //导入依赖的package包/类
@Test
public void schedulerRepositoryExposure() throws Exception {
	ClassPathXmlApplicationContext ctx = context("schedulerRepositoryExposure.xml");
	assertSame(SchedulerRepository.getInstance().lookup("myScheduler"), ctx.getBean("scheduler"));
	ctx.close();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:7,代码来源:QuartzSupportTests.java


示例9: getAllSchedulers

import org.quartz.impl.SchedulerRepository; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static List<Scheduler> getAllSchedulers() {
	return new ArrayList<Scheduler>(SchedulerRepository.getInstance().lookupAll());
}
 
开发者ID:javamelody,项目名称:javamelody,代码行数:5,代码来源:JobInformations.java


示例10: getScheduler

import org.quartz.impl.SchedulerRepository; //导入依赖的package包/类
/**
 * 删除不够通用
 * @param schedName
 * @return
 */
public static Scheduler getScheduler(String schedName) {
    return SchedulerRepository.getInstance().lookup(schedName);
}
 
开发者ID:quartzweb,项目名称:quartz-web,代码行数:9,代码来源:QuartzUtils.java


示例11: getAllScheduler

import org.quartz.impl.SchedulerRepository; //导入依赖的package包/类
/**
 * 获取仓库中所有的Scheduler集合
 * @return
 */
public static Collection<Scheduler> getAllScheduler(){
   return SchedulerRepository.getInstance().lookupAll();
}
 
开发者ID:quartzweb,项目名称:quartz-web,代码行数:8,代码来源:QuartzUtils.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MKDIR3Response类代码示例发布时间:2022-05-22
下一篇:
Java JShell类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap