X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=crawler%2Fkissweb%2Fsrc%2Forg%2Fwamblee%2Fcrawler%2Fkiss%2Fservlet%2FApplication.java;h=19d3b6faf4f4f743684316e16925d81641c14438;hb=945d06753950da5bb62974c13cd5d24a3f390115;hp=a4e78f74e2529f822b5851585185bbf326b62dbf;hpb=dcb2b98ba341933291b71f5bba19e490f4842748;p=utils diff --git a/crawler/kissweb/src/org/wamblee/crawler/kiss/servlet/Application.java b/crawler/kissweb/src/org/wamblee/crawler/kiss/servlet/Application.java index a4e78f74..19d3b6fa 100644 --- a/crawler/kissweb/src/org/wamblee/crawler/kiss/servlet/Application.java +++ b/crawler/kissweb/src/org/wamblee/crawler/kiss/servlet/Application.java @@ -16,28 +16,22 @@ package org.wamblee.crawler.kiss.servlet; -import java.util.Date; - import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; -import org.quartz.JobDetail; -import org.quartz.Scheduler; import org.quartz.SchedulerException; -import org.quartz.SchedulerFactory; -import org.quartz.Trigger; -import org.quartz.TriggerUtils; -import org.quartz.core.QuartzScheduler; -import org.quartz.impl.StdSchedulerFactory; -import org.wamblee.crawler.kiss.scheduling.quartz.CrawlerJob; -import org.wamblee.crawler.kiss.scheduling.quartz.QuartzCrawlerScheduler; +import org.wamblee.crawler.kiss.scheduling.CrawlerScheduler; import org.wamblee.general.BeanKernel; /** * The mechanism for kick starting the scheduling of the KiSS crawler. */ public class Application implements ServletContextListener { - + + /** + * Constructs the listener. + * + */ public Application() { // Empty. } @@ -51,8 +45,9 @@ public class Application implements ServletContextListener { aEvent.getServletContext().log("KiSS Crawler initializing"); try { getScheduler().initialize(); - } catch (SchedulerException e) { + } catch (Exception e) { aEvent.getServletContext().log("Error scheduling job", e); + return; } aEvent.getServletContext().log("KiSS Crawler initialized"); } @@ -66,17 +61,22 @@ public class Application implements ServletContextListener { aEvent.getServletContext().log("KiSS Crawler shutting down"); try { getScheduler().shutdown(); - } catch (SchedulerException e) { + } catch (Exception e) { aEvent.getServletContext().log("Error scheduling job", e); + return; } aEvent.getServletContext().log("KiSS Crawler shut down complete"); } - private QuartzCrawlerScheduler getScheduler() { - return BeanKernel.getBeanFactory().find(QuartzCrawlerScheduler.class); + /** + * Gets the scheduler from Spring. + * @return Scheduler. + */ + private CrawlerScheduler getScheduler() { + return BeanKernel.getBeanFactory().find(CrawlerScheduler.class); } - public static void main(String[] aArgs) throws SchedulerException { + public static void main(String[] aArgs) throws Exception { Application application = new Application(); application.getScheduler().initialize(); }