X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=crawler%2Fkissweb%2Fsrc%2Forg%2Fwamblee%2Fcrawler%2Fkiss%2Fservlet%2FApplication.java;h=9220a62f741ee8cbd0c222675eff63cc5a08280f;hb=07cedd3f0730646ea35a7f668b3e1e872a4605d9;hp=a4e78f74e2529f822b5851585185bbf326b62dbf;hpb=c53b455e7bd72ad4748848fcbe0ebf079f1db884;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..9220a62f 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,21 @@ 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 +44,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 +60,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(); }