• Post Reply Bookmark Topic Watch Topic
  • New Topic

Apache Tomcat 6 Background thread  RSS feed

 
Juwles Alco
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a predefined table containing date/time records at which the server must perform tasks. How should I go about creating a thread to run in the background checking the database to see if the current time matches the time in the database?

Thanks,
J
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is nothing specific to JSP or Tomcat about this.
I'll move this to our servlets forum for you.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you haven't already, you should read up on ServletContextListener

You can use this to instanciate your timer when your application starts up.
It can also be used to shut down the timer when the app is stopped or restarted.

To build the timer, you can use either java.util.Timer or, if you need more fine grained control there are third party libraries out there like Quartz.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!