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


Java Scheduler.shutdown方法代码示例

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


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

示例1: initialize

import org.quartz.Scheduler; //导入方法依赖的package包/类
/**
 * <p>
 * Called during creation of the <code>Scheduler</code> in order to give
 * the <code>SchedulerPlugin</code> a chance to initialize.
 * </p>
 * 
 * @throws SchedulerConfigException
 *           if there is an error initializing.
 */
public void initialize(String name, final Scheduler scheduler, ClassLoadHelper classLoadHelper)
    throws SchedulerException {

    getLog().info("Registering Quartz shutdown hook.");

    Thread t = new Thread("Quartz Shutdown-Hook "
            + scheduler.getSchedulerName()) {
        @Override
        public void run() {
            getLog().info("Shutting down Quartz...");
            try {
                scheduler.shutdown(isCleanShutdown());
            } catch (SchedulerException e) {
                getLog().info(
                        "Error shutting down Quartz: " + e.getMessage(), e);
            }
        }
    };

    Runtime.getRuntime().addShutdownHook(t);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:31,代码来源:ShutdownHookPlugin.java

示例2: schedulerShutdown

import org.quartz.Scheduler; //导入方法依赖的package包/类
public void schedulerShutdown(String schedulerName, boolean waitForJobsToComplete) throws SchedulerException {
    Scheduler scheduler = this.getAssertScheduler(schedulerName);
    if (!scheduler.isShutdown()) {
        List<JobDetail> allJobsOfScheduler = QuartzUtils.getAllJobsOfScheduler(scheduler);
        for (JobDetail jobDetail : allJobsOfScheduler) {
            QuartzUtils.pauseJob(jobDetail, scheduler);
        }
        if (waitForJobsToComplete) {
            scheduler.shutdown(waitForJobsToComplete);
        } else {
            scheduler.shutdown();
        }
    }
}
 
开发者ID:quartzweb,项目名称:quartz-web,代码行数:15,代码来源:QuartzManager.java

示例3: stopService

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

    try {
        Scheduler scheduler = schedulerFactory.getScheduler();

        scheduler.shutdown();
    } catch (Exception e) {
        log.error("Failed to shutdown Scheduler", e);

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

    unbind(jndiName);

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

示例4: initialize

import org.quartz.Scheduler; //导入方法依赖的package包/类
/**
 * <p>
 * Called during creation of the <code>Scheduler</code> in order to give
 * the <code>SchedulerPlugin</code> a chance to initialize.
 * </p>
 * 
 * @throws SchedulerConfigException
 *           if there is an error initializing.
 */
public void initialize(String name, final Scheduler scheduler)
    throws SchedulerException {
    this.name = name;
    this.scheduler = scheduler;

    getLog().info("Registering Quartz shutdown hook.");

    Thread t = new Thread("Quartz Shutdown-Hook "
            + scheduler.getSchedulerName()) {
        public void run() {
            getLog().info("Shutting down Quartz...");
            try {
                scheduler.shutdown(isCleanShutdown());
            } catch (SchedulerException e) {
                getLog().info(
                        "Error shutting down Quartz: " + e.getMessage(), e);
            }
        }
    };

    Runtime.getRuntime().addShutdownHook(t);
}
 
开发者ID:AsuraTeam,项目名称:asura,代码行数:32,代码来源:ShutdownHookPlugin.java

示例5: setUp

import org.quartz.Scheduler; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception
{
    applicationContext = ApplicationContextHelper.getApplicationContext();
    String testid = ""+System.currentTimeMillis();
    
    // Let's shut down the scheduler so that we aren't competing with the scheduled versions of the post lookup and
    // feed generator jobs
    Scheduler scheduler = (Scheduler) applicationContext.getBean("schedulerFactory");
    scheduler.shutdown();
    
    // Get the required services
    this.activityService = (ActivityService)applicationContext.getBean("activityService");
    this.siteService = (SiteService)applicationContext.getBean("SiteService");
    this.authenticationService = (MutableAuthenticationService)applicationContext.getBean("AuthenticationService");
    this.personService = (PersonService)applicationContext.getBean("PersonService");
    this.nodeArchiveService = (NodeArchiveService)applicationContext.getBean("nodeArchiveService");
    
    LocalFeedTaskProcessor feedProcessor = null;
    
    // alternative: would need to add subsystem context to config location (see above)
    //this.postLookup = (PostLookup)applicationContext.getBean("postLookup");
    //this.feedGenerator = (FeedGenerator)applicationContext.getBean("feedGenerator");
    //feedProcessor = (LocalFeedTaskProcessor)applicationContext.getBean("feedTaskProcessor");
    
    ChildApplicationContextFactory activitiesFeed = (ChildApplicationContextFactory)applicationContext.getBean("ActivitiesFeed");
    ApplicationContext activitiesFeedCtx = activitiesFeed.getApplicationContext();
    this.postLookup = (PostLookup)activitiesFeedCtx.getBean("postLookup");
    this.feedGenerator = (FeedGenerator)activitiesFeedCtx.getBean("feedGenerator");
    feedProcessor = (LocalFeedTaskProcessor)activitiesFeedCtx.getBean("feedTaskProcessor");
    
    
    List<String> templateSearchPaths = new ArrayList<String>(1);
    templateSearchPaths.add(TEST_TEMPLATES_LOCATION);
    feedProcessor.setTemplateSearchPaths(templateSearchPaths);
    feedProcessor.setUseRemoteCallbacks(false);
    
    site1 = "test_site1_" + testid;
    site2 = "test_site2_" + testid;
    site3 = "test_site3_" + testid;
    
    user1 = "Test_User1_" + testid;
    user2 = "Test_User2_" + testid;
    user3 = "Test_User3_" + testid;
    user4 = "Test_User4_" + testid;
    
    
    // create users
    
    login(ADMIN_USER, ADMIN_PW);
    
    createUser(user1, USER_PW);
    createUser(user2, USER_PW);
    createUser(user3, USER_PW);
    createUser(user4, USER_PW);
    
    // create sites
    
    // create public site
    createSite(site1, true);
    
    // create private sites
    createSite(site2, false);
    createSite(site3, false);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:66,代码来源:AbstractSiteActivityTest.java

示例6: shutdown

import org.quartz.Scheduler; //导入方法依赖的package包/类
/**
 * 关闭所有调度任务
 */
public void shutdown() {
	try {
		Collection<Scheduler> allSchedulers = SF.getAllSchedulers();
		for (Scheduler s : allSchedulers) {
			s.shutdown();
		}
	} catch (SchedulerException e) {
		log.error("shut down error!", e);
	}
}
 
开发者ID:HankXV,项目名称:Limitart,代码行数:14,代码来源:SchedulerUtil.java

示例7: setUp

import org.quartz.Scheduler; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception
{
    ctx = ApplicationContextHelper.getApplicationContext();
    JobLockService jobLockService = (JobLockService) ctx.getBean("JobLockService");
    PolicyComponent policyComponent = (PolicyComponent) ctx.getBean("policyComponent");
    NodeService nodeService = (NodeService) ctx.getBean("NodeService");

    siteService = (SiteService) ctx.getBean("SiteService");
    personService = (PersonService) ctx.getBean("PersonService");
    feedDAO = (ActivityFeedDAO) ctx.getBean("feedDAO");
    transactionHelper = (RetryingTransactionHelper)ctx.getBean("retryingTransactionHelper");
    nodeArchiveService = (NodeArchiveService)ctx.getBean("nodeArchiveService");
    
    // Let's shut down the scheduler so that we aren't competing with the scheduled versions of jobs (ie. feed cleaner)
    Scheduler scheduler = (Scheduler) ctx.getBean("schedulerFactory");
    scheduler.shutdown();
    
    tearDown();
    
    AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
    for (int i = 1; i <= 7; i++)
    {
        siteService.createSite("myPreset", "testSite"+i, null, null, SiteVisibility.PUBLIC);
    }
    
    AuthenticationUtil.setRunAsUserSystem();
    
    // construct the test cleaner
    cleaner = new FeedCleaner();
    cleaner.setFeedDAO(feedDAO);
    cleaner.setPolicyComponent(policyComponent);
    cleaner.setJobLockService(jobLockService);
    cleaner.setNodeService(nodeService);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:36,代码来源:AbstractFeedCleanerTest.java

示例8: shutdown

import org.quartz.Scheduler; //导入方法依赖的package包/类
/**
 * 停止任务调度.
 * 
 * @param taskID 任务主键
 */
public static void shutdown(final Protos.TaskID taskID) {
    Scheduler scheduler = RUNNING_SCHEDULERS.remove(taskID.getValue());
    if (null != scheduler) {
        try {
            scheduler.shutdown();
        } catch (final SchedulerException ex) {
            throw new JobSystemException(ex);
        }
    }
}
 
开发者ID:elasticjob,项目名称:elastic-job-cloud,代码行数:16,代码来源:DaemonTaskScheduler.java

示例9: stopScheduler

import org.quartz.Scheduler; //导入方法依赖的package包/类
private void stopScheduler() {
    log.warn("Stopping scheduler (pid:" + ServerUtil.getCurrentPid() + ")");
    try {
        // Grab the Scheduler instance from the Factory
        Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler();

        // and start it off
        scheduler.shutdown();

    } catch (SchedulerException se) {
        log.error("Scheduler fail to stop", se);
    }
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:14,代码来源:Server.java

示例10: shutdownJobs

import org.quartz.Scheduler; //导入方法依赖的package包/类
/** 
 * @Description 关闭所有定时任务  
 *   
 *  
 */  
public static void shutdownJobs() {    
    try {    
        Scheduler sched = gSchedulerFactory.getScheduler();    
        if (!sched.isShutdown()) {    
            sched.shutdown();    
        }    
    } catch (Exception e) {    
        throw new RuntimeException(e);    
    }    
}
 
开发者ID:jeffreyning,项目名称:nh-micro,代码行数:16,代码来源:MicroQuartzManager.java

示例11: shutdownAllJob

import org.quartz.Scheduler; //导入方法依赖的package包/类
@Transactional
@Override
public boolean shutdownAllJob() {
	try {
		Scheduler scheduler = schedulerFactoryBean.getScheduler();
		scheduler.shutdown(false);
	} catch (SchedulerException e) {
		throw new ServiceException(e);
	}
	return Boolean.TRUE;
}
 
开发者ID:wjggwm,项目名称:webside,代码行数:12,代码来源:ScheduleJobServiceImpl.java

示例12: shutdownQuarts

import org.quartz.Scheduler; //导入方法依赖的package包/类
private void shutdownQuarts() throws SchedulerException {
  final SchedulerFactory factory = new StdSchedulerFactory();
  final Scheduler scheduler = factory.getScheduler();
  scheduler.shutdown();
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:6,代码来源:ConfigurationService.java


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