Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Poller ??

 
Anup Bansal
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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,
Anup
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Steve Luke
Bartender
Posts: 4181
21
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic