@Test public void testSchedulerRestart() throws Exception { logger.info("testSchedulerRestart"); DefaultChainedExecutable job = new DefaultChainedExecutable(); BaseTestExecutable task1 = new FiveSecondSucceedTestExecutable(); job.addTask(task1); execMgr.addJob(job); Thread.sleep(3000); scheduler.shutdown(); startScheduler(); waitForJobFinish(job.getId(), MAX_WAIT_TIME); Assert.assertEquals(ExecutableState.SUCCEED, execMgr.getOutput(job.getId()).getState()); Assert.assertEquals(ExecutableState.SUCCEED, execMgr.getOutput(task1.getId()).getState()); }
@Override public void shutdown() throws SchedulerException { logger.info("Shutting down DefaultScheduler ...."); jobLock.unlockJobEngine(); initialized = false; hasStarted = false; try { fetcherPool.shutdownNow(); fetcherPool.awaitTermination(1, TimeUnit.MINUTES); } catch (InterruptedException e) { logger.warn("InterruptedException is caught when shutting down job fetcher.", e); } try { jobPool.shutdownNow(); jobPool.awaitTermination(1, TimeUnit.MINUTES); } catch (InterruptedException e) { logger.warn("InterruptedException is caught when shutting down job pool.", e); } }
DefaultScheduler implements Scheduler<AbstractExecutable> { @Override public void shutdown() throws SchedulerException { logger.info("Shutting down DefaultScheduler ...."); jobLock.unlockJobEngine(); initialized = false; hasStarted = false; try { fetcherPool.shutdownNow(); fetcherPool.awaitTermination(1, TimeUnit.MINUTES); } catch (InterruptedException e) { logger.warn("InterruptedException is caught when shutting down job fetcher.", e); } try { jobPool.shutdownNow(); jobPool.awaitTermination(1, TimeUnit.MINUTES); } catch (InterruptedException e) { logger.warn("InterruptedException is caught when shutting down job pool.", e); } } }
DefaultScheduler implements Scheduler<AbstractExecutable> { @Override public void shutdown() throws SchedulerException { logger.info("Shutting down DefaultScheduler ...."); jobLock.unlockJobEngine(); initialized = false; hasStarted = false; try { fetcherPool.shutdownNow(); fetcherPool.awaitTermination(1, TimeUnit.MINUTES); } catch (InterruptedException e) { logger.warn("InterruptedException is caught when shutting down job fetcher.", e); } try { jobPool.shutdownNow(); jobPool.awaitTermination(1, TimeUnit.MINUTES); } catch (InterruptedException e) { logger.warn("InterruptedException is caught when shutting down job pool.", e); } } DefaultScheduler(); }
DefaultScheduler implements Scheduler<AbstractExecutable> { @Override public void shutdown() throws SchedulerException { logger.info("Shutting down DefaultScheduler ...."); jobLock.unlockJobEngine(); initialized = false; hasStarted = false; try { fetcherPool.shutdownNow(); fetcherPool.awaitTermination(1, TimeUnit.MINUTES); } catch (InterruptedException e) { logger.warn("InterruptedException is caught when shutting down job fetcher.", e); } try { jobPool.shutdownNow(); jobPool.awaitTermination(1, TimeUnit.MINUTES); } catch (InterruptedException e) { logger.warn("InterruptedException is caught when shutting down job pool.", e); } } DefaultScheduler(); synchronized static DefaultScheduler getInstance(); static synchronized DefaultScheduler createInstance(); static synchronized void destroyInstance(); ExecutableManager getExecutableManager(); FetcherRunner getFetcherRunner(); @Override synchronized void init(JobEngineConfig jobEngineConfig, JobLock lock); @Override void shutdown(); @Override boolean hasStarted(); }
DefaultScheduler implements Scheduler<AbstractExecutable> { @Override public void shutdown() throws SchedulerException { logger.info("Shutting down DefaultScheduler ...."); jobLock.unlockJobEngine(); initialized = false; hasStarted = false; try { fetcherPool.shutdownNow(); fetcherPool.awaitTermination(1, TimeUnit.MINUTES); } catch (InterruptedException e) { logger.warn("InterruptedException is caught when shutting down job fetcher.", e); } try { jobPool.shutdownNow(); jobPool.awaitTermination(1, TimeUnit.MINUTES); } catch (InterruptedException e) { logger.warn("InterruptedException is caught when shutting down job pool.", e); } } DefaultScheduler(); synchronized static DefaultScheduler getInstance(); static synchronized DefaultScheduler createInstance(); static synchronized void destroyInstance(); ExecutableManager getExecutableManager(); FetcherRunner getFetcherRunner(); @Override synchronized void init(JobEngineConfig jobEngineConfig, JobLock lock); @Override void shutdown(); @Override boolean hasStarted();  }