permaculture playing cards
The moose likes Threads and Synchronization and the fly likes eternal process Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "eternal process" Watch "eternal process" New topic

eternal process

Joseph Sweet
Ranch Hand

Joined: Jan 29, 2005
Posts: 327
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?

We must know, we will know. -- David Hilbert
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
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.

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
I agree. Here's the link:
subject: eternal process
jQuery in Action, 3rd edition