This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I developed a Java Web Application.
In the application, I wrote a scheduler, which is a java program that has main method, to perform certain operation if criteria is met. Now I want to start the scheduler when the application is started. Can anyone please help me how to accomplish the requirement.
abani patra wrote:You can start the scheduler in init method of servlet so that on the 1st request it will be started.
You could certainly do that if you were working in an environment which didn't have ServletContextListeners. But if your environment has ServletContextListeners -- which it will unless it has been running without upgrades for the last 8 years or so -- you should use them.