Polling from my java class vs. using polling service
posted 15 years ago
Hi, I have a java class that needs to be run after every 10 minutes to check for a DB change and accordingly perform certain functions. I am unable to decide the pros and cons of achieving this either by: 1) writing a *.bat and scheduling it using scheduler, or 2) to use a thread that sleeps according the the wait() function. I have an inclination to use the latter, but the problem is that if the DB goes down, then the thread might be broken. I would appreciate if anybody can give their thoughts on the above, especially in the use of method 2. Any code sample would be super.