Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

eternal process

 
Joseph Sweet
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to create an eternal process (thread?) that will run on the server and will scan a database to see if certain things should be done. this process should be in a pretty low priority.

any ideas/links about what I should do to implement this?
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use the Timer class in the library to run a task at scheduled times. Timer is a normal Java thread with a loop in the run() method and it can be set to never end. It would be nice to have a clean way to terminate it. Ctrl-C works, but a UI or a remote interface - eg a socket protocol - would be better.

I have no idea what your skills are. Does this sound fun or a bit daunting or like I'm not speaking English? Don't be afraid to ask for more detail. If you haven't used Timer before, try to make something that just says "Hello" every 20 seconds and see how it all works.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic