當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。