I am working on a web application that needs to clear expired cache items from time to time. I would like to do this using the Quartz framework and have a separate work to take part in this.
Now I have used Quartz in other projects and usually schedule all jobs from ServletContextListener using contextInitialised (ServletContextEvent sce) and contextDestroyed (ServletContextEvent sce). However, I did it this way because the textbook I once read did it that way.
I'm not sure if I can just schedule tasks from the init () and destroy () methods instead? I think it can be argued that now I am mixing background tasks and servlets and therefore responsibilities, but I would like to hear if there is a βbest practiceβ on this?
source
share