Home arrow static arrow Java Programming [Archive] - Reworded: Running a background program
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - Reworded: Running a background program
10 Duke Stars available
This topic has 2 replies on 1 page.

Posts:5
Registered: 6/21/04
Reworded: Running a background program  
Jun 21, 2004 10:26 AM



 
For example, I have a java program that checks the database if there are any new insertions. The question I want solved is that I want my java program to be executing in the background whether there is another thread or process being executed in my Linux machine. Basically, I want the java program to poll for new insertions. I heard of a command called Thread.Sleep(1000) which pauses the process for 1 second. IS there any other solutions for creating a background polling thread?
 

Posts:3,055
Registered: 18/06/98
Re: Reworded: Running a background program  
Jun 21, 2004 11:45 AM (reply 1 of 2)



 
You can use it, or then java.util.Timer / java.util.TimerTask. It depends on your problem's complexity.
 

Posts:1,657
Registered: 1/8/98
Re: Reworded: Running a background program  
Jun 21, 2004 8:11 PM (reply 2 of 2)



 
The other question is "What do you mean by background?" Runs at system startup time? Runs when you explicitly invoke it? There are several Linux/GNU utilities which will run programs (like the JVM) without interaction, but you have to be a bit more explicit in what you want to do with the program. And, no, Thread. sleep() does not put the task "in the background" wiki/./- it just suspends it for the specified time period.
 
This topic has 2 replies on 1 page.