File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Threads and Synchronization and the fly likes Java Poller ?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Java Poller ??" Watch "Java Poller ??" New topic

Java Poller ??

Anup Bansal
Ranch Hand

Joined: Sep 12, 2006
Posts: 69

I need a suggestion on the following:
I am currently working on a design to implement a java application that would continuously poll an oracle table for new records. For each new record a request should be initiated that will process this record.
The request will basically be handled as HTTP.

Now I do not want the poller program to stop, and if it does then a backup mechanism should be in place to trigger this program.

How can i achieve this?

Please advice.

Thanks & regards,
Nitesh Kant

Joined: Feb 25, 2007
Posts: 1638

You can run your application as an OS level service.
Java service wrapper is one library that will help you do the same.

Anup: and if it does then a backup mechanism should be in place to trigger this program.

What if the back mechanism fails? There are tools available like servicehawk that monitor OS level services but i am not sure whether you can hook onto them programmatically.

Java service wrapper provides you a facility to raise alerts when the service crashes.

apigee, a better way to API!
Steve Luke

Joined: Jan 28, 2003
Posts: 4181

You can also run the application as a single poll, then use your OS' scheduler to make a repeating task to run the application. There are a handful of benefits to this:
1) Your app doesn't eat any resources when not working.
2) If your app does fail for some reason, you have lost only one poll, not all future polls.
3) You can accomplish fairly complex scheduling without having to write it yourself or find a package that does it for you.

I agree. Here's the link:
subject: Java Poller ??
It's not a secret anymore!