dcsimg
Terminate and Stay Resident Java programs using Threads
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Saturday, December 6, 2003 03:50 AM

Hi,
I want to achieve teh functionality of polling a database in regular intervals of time. I want the java application to terminate and the thread to keep performing this actvity at regular intervals of time . Is this possilbe? Is there any other better way for me to poll the database? I have access to the DNS but not to the server as such to put server side code. So what I am looking at is a distributed Architecture where my java program runs on one machine polling and updating the database while my database server connects to the front end on different machines.

Thanking you
Avinash

Re: Terminate and Stay Resident Java programs using Threads

Posted By:   Christopher_Koenigsberg  
Posted On:   Monday, December 8, 2003 06:45 AM

My naive thoughts:


Maybe consider a cron job, for periodic scheduled execution? depending on the interval, since starting up a new JVM incurs considerable overhead.


Or, to keep the same JVM running all along, perhaps starting something as a "daemon" (Unix) or "service" (Windows), so it runs detached from the beginning?


In fact maybe you could just run Tomcat, and write a servlet, to load-on-startup, which would just start up your background thread? then you could use Tomcat to manage the JVM container, instead of writing your own wrapper?


Otherwise, you could just background an ordinary application, right, keep it running in the background?

About | Sitemap | Contact