quartz Scheduler with spring MVC without using maven -


i using tomcat version 7.0. requirement when tomcat starts up, start quartzscheduler schedule jobs @ regular interval.


can 1 give me best example problem using contextlistener (this might clean approach start scheduler inside contextinitialized method , shutdown scheduler inside contextdestroyed method) or other methods .

*note : without using maven

you can implement servletcontextlistener (quartztestlistener) , add listener in web xml file below

 <listener>         <listener-class>com.test.quartztestlistener</listener-class>     </listener> 

wherein implement contextinitialized methods below:

@override public void contextinitialized(servletcontextevent ctx) {     jobdetail job = jobbuilder.newjob(quartzjob.class)     .withidentity("testjobname", "test1").build();       try{       scheduler   scheduler = ((stdschedulerfactory) ctx.getservletcontext().getattribute(quartzinitializerlistener.quartz_factory_key)).getscheduler();         scheduler.schedulejob(job, new crontrigger(...));         }catch(schedulerexception e){     } } 

alternatively can make use quartzinitializerlistener .


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -