• Post Reply Bookmark Topic Watch Topic
  • New Topic

Threading Process Question

 
Grant Morris
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to design a process for an application using threads. I am having trouble figuring out the best way to do things. I have an application that will connect to a database, then periodically check for updates and send messages based on the updates. I am using a TimerTask object to check for and process the updates.
My goal is to make the application recover from database disconnects and message errors by 1.) closing the db connection and re-connecting, and 2.) stop the process that checks for updates and restart it.
I thought that I could do this using some threads and having an "outer/parent" thread connect to the database and start the TimerTask process and then wait until the TimerTask process encounters and error and notifies it to restart. However, I'm having trouble because once I cancel the process, I can't get it to run again even though I re-instantiate the object. (I know cancel() keeps it from running again, but I though if I could re-instantiate it, that it would create a new object and thus run again.)
Any ideas on how to accomplish this. Thanks for the help.
 
Grant Morris
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nevermind, I think I got it figured out.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!