This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori 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.