I have a Web Application with J2EE and Spring, related to an Oracle 10g Database. I want to create a Service in Java that will poll statistics from the Database and send mail every 5 min. This Service should start when the application is deployed under Tomcat or Web-sphere.
Any Ideas How this could be done ??
Thanks
I have a Web Application with J2EE and Spring, related to an Oracle 10g
Share
Since use Spring, its Time execution and scheduling classes seem a natural choice. They work both in Tomcat and Websphere, just create your task as a POJO and schedule it:
The
PollingTasklooks like (note that it doesn’t have to implementRunnable, “run” method is just a convention):