Re: [OT] RE: automatic periodic execution of code
Thanks for the answer brian ...I will have a look at your sample carrefully... Yes, I'm trying to configure Quartz with Websphere using a Servletbut I'm not sure of my Quartz.properties file to begin...:( The documentation is very poor and not much support...maybe I will have to use it another way (like your plugin suggestion).. Anyone have managed configure Quartz with Websphere? TIA Gaet - Original Message - From: "Barnett, Brian W." <[EMAIL PROTECTED]> To: "'Struts Users Mailing List'" Sent: Wednesday, February 16, 2005 5:34 PM Subject: [OT] RE: automatic periodic execution of code > Are you trying to configure Quartz in web.xml as a servlet or in > struts-config.xml as a struts plug-in? > > We're using Tomcat, not WebSphere, but it seems like we ran into a few > issues trying to run it as a servlet. I don't remember what the issues were, > sorry. > > We ended up running it as a struts plug-in. Here's some sample code: > > --snippet from struts-config.xml-- > > > --QuartzPlugin class-- > public class QuartzPlugin implements PlugIn { > private final static Log log = > LogFactory.getLog(QuartzPlugin.class.getName()); > private String SCHOLAR_GROUP = "ScholarGroup"; > Scheduler sched; > > public void init(ActionServlet servlet, ModuleConfig moduleConfig) > throws ServletException { > log.info("Quartz starting"); > > try { > sched = StdSchedulerFactory.getDefaultScheduler(); > sched.start(); > > // Register job listeners with the scheduler > sched.addJobListener(new Stethoscope()); > > // Get the JobDetail object for our HeartBeatJob > JobDetail jobDetail = > sched.getJobDetail("HeartBeatJob", "ScholarJobGroup"); > > // Assign the Stethoscope to listen to the heart > beat. > jobDetail.addJobListener(Stethoscope.LISTENER_NAME); > > } catch (Exception e) { > log.info("Quartz Scheduler failed to initialize: " + > e.toString()); > throw new ServletException(e); > } > > log.debug("Quartz started"); > } > > public void destroy() { > log.info("Quartz stopping"); > > try { > sched.shutdown(); > } catch (SchedulerException ex) { > ex.printStackTrace(); > } > > sched = null; > } > > -Original Message- > From: Gaet [mailto:[EMAIL PROTECTED] > Sent: Wednesday, February 16, 2005 2:47 AM > To: Struts Users Mailing List > Subject: Re: automatic periodic execution of code > > Hello, > > I know it is not the right place but does someone make Quartz works with > Websphere??? > I'm trying this since two days and I'm unable to make it worksand I > haven't find a Quartz mailing list... > > If somebody has experience and can help me...TIA... > > Gaet > > - Original Message - > From: "Cedric Levieux" <[EMAIL PROTECTED]> > To: "Struts Users Mailing List" > Sent: Wednesday, February 16, 2005 10:19 AM > Subject: Re: automatic periodic execution of code > > > > Thanks for the Quartz project, I'll try it. for the moment I've got my own > > Thread Management system but using "standard" is for me a better thing. > > > > I hope that whan I'll stop tomcat Quatrz will shutdown too in a short > time. > > > > Thx, > > > > Cedric > > > > - Original Message - > > From: "Andrew Hill" <[EMAIL PROTECTED]> > > To: "Struts Users Mailing List" > > Sent: Wednesday, February 16, 2005 6:54 AM > > Subject: Re: automatic periodic execution of code > > > > > > > I think Quartz has been the general consensus most times this has been > > > debated on the list. > > > > > > Sng Wee Jim wrote: > > > > > > > Hi, > > > > > > > > > > > > > > > > > > > > What would be the recommended way to execute some code periodically on > > > > tomcat/appserver? > > > > > > > > > > > > > > > > > > > > > > > > Should I > > > > > > > > > > > > 1. start a thread (not recommended in appserver and tomcat?) and do > > > > it in the run method > > > > > > > > 2. use third party tool like Quartz > > > > 3. or is there existing struts plugin to do it? > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > - Jim > > > > > > > > > > > &
[OT] RE: automatic periodic execution of code
Are you trying to configure Quartz in web.xml as a servlet or in struts-config.xml as a struts plug-in? We're using Tomcat, not WebSphere, but it seems like we ran into a few issues trying to run it as a servlet. I don't remember what the issues were, sorry. We ended up running it as a struts plug-in. Here's some sample code: --snippet from struts-config.xml-- --QuartzPlugin class-- public class QuartzPlugin implements PlugIn { private final static Log log = LogFactory.getLog(QuartzPlugin.class.getName()); private String SCHOLAR_GROUP = "ScholarGroup"; Scheduler sched; public void init(ActionServlet servlet, ModuleConfig moduleConfig) throws ServletException { log.info("Quartz starting"); try { sched = StdSchedulerFactory.getDefaultScheduler(); sched.start(); // Register job listeners with the scheduler sched.addJobListener(new Stethoscope()); // Get the JobDetail object for our HeartBeatJob JobDetail jobDetail = sched.getJobDetail("HeartBeatJob", "ScholarJobGroup"); // Assign the Stethoscope to listen to the heart beat. jobDetail.addJobListener(Stethoscope.LISTENER_NAME); } catch (Exception e) { log.info("Quartz Scheduler failed to initialize: " + e.toString()); throw new ServletException(e); } log.debug("Quartz started"); } public void destroy() { log.info("Quartz stopping"); try { sched.shutdown(); } catch (SchedulerException ex) { ex.printStackTrace(); } sched = null; } -Original Message- From: Gaet [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 16, 2005 2:47 AM To: Struts Users Mailing List Subject: Re: automatic periodic execution of code Hello, I know it is not the right place but does someone make Quartz works with Websphere??? I'm trying this since two days and I'm unable to make it worksand I haven't find a Quartz mailing list... If somebody has experience and can help me...TIA... Gaet - Original Message - From: "Cedric Levieux" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" Sent: Wednesday, February 16, 2005 10:19 AM Subject: Re: automatic periodic execution of code > Thanks for the Quartz project, I'll try it. for the moment I've got my own > Thread Management system but using "standard" is for me a better thing. > > I hope that whan I'll stop tomcat Quatrz will shutdown too in a short time. > > Thx, > > Cedric > > - Original Message - > From: "Andrew Hill" <[EMAIL PROTECTED]> > To: "Struts Users Mailing List" > Sent: Wednesday, February 16, 2005 6:54 AM > Subject: Re: automatic periodic execution of code > > > > I think Quartz has been the general consensus most times this has been > > debated on the list. > > > > Sng Wee Jim wrote: > > > > > Hi, > > > > > > > > > > > > > > > What would be the recommended way to execute some code periodically on > > > tomcat/appserver? > > > > > > > > > > > > > > > > > > Should I > > > > > > > > > 1. start a thread (not recommended in appserver and tomcat?) and do > > > it in the run method > > > > > > 2. use third party tool like Quartz > > > 3. or is there existing struts plugin to do it? > > > > > > > > > > > > > > > > > > > > > > > > - Jim > > > > > > > > > > > > > > > > > > > > > > > > > > > The information in this email is confidential and is intended solely > > > for the addressee(s). > > > Access to this email by anyone else is unauthorized. If you are not > > > an intended recipient, please notify the sender of this email > > > > > > immediately. You should not copy, use or disseminate the > > > > > > information contained in the email. > > > Any views expressed in this message are those of the individual > > > sender, except where the sender specifically states them to be > > > the views of Capco. > > > > > > http://www.capco.com/ > > > > > > > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]