@Test(timeout = 50000) public void testNoRepeatStart() { EgovSchedulerRunner egovSchedulerRunner = new EgovSchedulerRunner("/META-INF/spring/launch/context-scheduler.xml", "/META-INF/spring/launch/context-job.xml", new ArrayList<String>(), 30000); egovSchedulerRunner.start(); }
public void start() { List<String> paths = new ArrayList<String>(); paths.add(contextPath); paths.add(schedulerJobPath); for (int index = 0; index < jobPaths.size(); index++) { paths.add(jobPaths.get(index)); } String[] locations = paths.toArray(new String[paths.size()]); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(locations, false); context.refresh(); LOGGER.warn("ApplicationContext Running Time: {} seconds ", delayTime / 1000); boolean mustContinue = false; long realDelayTIme = delayTime; if (delayTime < 0) { mustContinue = true; realDelayTIme = -1 * delayTime; } if (mustContinue) { LOGGER.info("Continue..."); while (!Thread.currentThread().isInterrupted()) { try { Thread.sleep(realDelayTIme); } catch (InterruptedException ie) { break; } } LOGGER.info("Sleeping ends..."); context.close(); } else { try { LOGGER.info("Sleeping Time: {} sedonds ", realDelayTIme / 1000); Thread.sleep(realDelayTIme); LOGGER.info("Sleeping ends..."); } catch (InterruptedException ie) { LOGGER.info("Sleeping has Interrupted..."); } context.close(); } }
EgovSchedulerRunner { public void start() { List<String> paths = new ArrayList<String>(); paths.add(contextPath); paths.add(schedulerJobPath); for (int index = 0; index < jobPaths.size(); index++) { paths.add(jobPaths.get(index)); } String[] locations = paths.toArray(new String[paths.size()]); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(locations, false); context.refresh(); LOGGER.warn("ApplicationContext Running Time: {} seconds ", delayTime / 1000); boolean mustContinue = false; long realDelayTIme = delayTime; if (delayTime < 0) { mustContinue = true; realDelayTIme = -1 * delayTime; } if (mustContinue) { LOGGER.info("Continue..."); while (!Thread.currentThread().isInterrupted()) { try { Thread.sleep(realDelayTIme); } catch (InterruptedException ie) { break; } } LOGGER.info("Sleeping ends..."); context.close(); } else { try { LOGGER.info("Sleeping Time: {} sedonds ", realDelayTIme / 1000); Thread.sleep(realDelayTIme); LOGGER.info("Sleeping ends..."); } catch (InterruptedException ie) { LOGGER.info("Sleeping has Interrupted..."); } context.close(); } } }
EgovSchedulerRunner { public void start() { List<String> paths = new ArrayList<String>(); paths.add(contextPath); paths.add(schedulerJobPath); for (int index = 0; index < jobPaths.size(); index++) { paths.add(jobPaths.get(index)); } String[] locations = paths.toArray(new String[paths.size()]); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(locations, false); context.refresh(); LOGGER.warn("ApplicationContext Running Time: {} seconds ", delayTime / 1000); boolean mustContinue = false; long realDelayTIme = delayTime; if (delayTime < 0) { mustContinue = true; realDelayTIme = -1 * delayTime; } if (mustContinue) { LOGGER.info("Continue..."); while (!Thread.currentThread().isInterrupted()) { try { Thread.sleep(realDelayTIme); } catch (InterruptedException ie) { break; } } LOGGER.info("Sleeping ends..."); context.close(); } else { try { LOGGER.info("Sleeping Time: {} sedonds ", realDelayTIme / 1000); Thread.sleep(realDelayTIme); LOGGER.info("Sleeping ends..."); } catch (InterruptedException ie) { LOGGER.info("Sleeping has Interrupted..."); } context.close(); } } EgovSchedulerRunner(String contextPath, String schedulerJobPath, List<String> jobPaths, long delayTime); }
EgovSchedulerRunner { public void start() { List<String> paths = new ArrayList<String>(); paths.add(contextPath); paths.add(schedulerJobPath); for (int index = 0; index < jobPaths.size(); index++) { paths.add(jobPaths.get(index)); } String[] locations = paths.toArray(new String[paths.size()]); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(locations, false); context.refresh(); LOGGER.warn("ApplicationContext Running Time: {} seconds ", delayTime / 1000); boolean mustContinue = false; long realDelayTIme = delayTime; if (delayTime < 0) { mustContinue = true; realDelayTIme = -1 * delayTime; } if (mustContinue) { LOGGER.info("Continue..."); while (!Thread.currentThread().isInterrupted()) { try { Thread.sleep(realDelayTIme); } catch (InterruptedException ie) { break; } } LOGGER.info("Sleeping ends..."); context.close(); } else { try { LOGGER.info("Sleeping Time: {} sedonds ", realDelayTIme / 1000); Thread.sleep(realDelayTIme); LOGGER.info("Sleeping ends..."); } catch (InterruptedException ie) { LOGGER.info("Sleeping has Interrupted..."); } context.close(); } } EgovSchedulerRunner(String contextPath, String schedulerJobPath, List<String> jobPaths, long delayTime); void setContextPath(String contextPath); void setSchedulerJobPath(String schedulerJobPath); void setJobPath(List<String> jobPaths); void setDelayTime(long delayTime); void start(); }
EgovSchedulerRunner { public void start() { List<String> paths = new ArrayList<String>(); paths.add(contextPath); paths.add(schedulerJobPath); for (int index = 0; index < jobPaths.size(); index++) { paths.add(jobPaths.get(index)); } String[] locations = paths.toArray(new String[paths.size()]); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(locations, false); context.refresh(); LOGGER.warn("ApplicationContext Running Time: {} seconds ", delayTime / 1000); boolean mustContinue = false; long realDelayTIme = delayTime; if (delayTime < 0) { mustContinue = true; realDelayTIme = -1 * delayTime; } if (mustContinue) { LOGGER.info("Continue..."); while (!Thread.currentThread().isInterrupted()) { try { Thread.sleep(realDelayTIme); } catch (InterruptedException ie) { break; } } LOGGER.info("Sleeping ends..."); context.close(); } else { try { LOGGER.info("Sleeping Time: {} sedonds ", realDelayTIme / 1000); Thread.sleep(realDelayTIme); LOGGER.info("Sleeping ends..."); } catch (InterruptedException ie) { LOGGER.info("Sleeping has Interrupted..."); } context.close(); } } EgovSchedulerRunner(String contextPath, String schedulerJobPath, List<String> jobPaths, long delayTime); void setContextPath(String contextPath); void setSchedulerJobPath(String schedulerJobPath); void setJobPath(List<String> jobPaths); void setDelayTime(long delayTime); void start();  }