I have a small java program running on a NT server. This program spawns a thread that wakes up every 2 minutes to monitor a log file. It usually runs okay for hours and then, all of a sudden, it would go to sleep and never wake up. There are very little activities on the server and I am using the method "sleep(2*60*1000);" to put the thread to sleep for 2 minutes. Any idea why? Andrew
hi, does the program actually go to sleep and never wake up or does it crash ? maybe something you are doing in the code is throwing an exception that is not being handled ? Since the program works fine for a few hours, it may be somthing related to memory ? Can you post the code of the loop ? What does the program do when it wakes up ? maybe the file handling of the log file causes some exception after sometime ? Just shooting off some thoughts ... hope this helps ..
[This message has been edited by Karthikraj Magapu (edited December 12, 2001).]
SJCP<br />SCEA P1
Joined: Dec 11, 2001
This is what my program does: It spawns a new thread when the program starts. This thread wakes up once every 2 minutes to check the log file. It searches for a specific string at the end of the file. If the string is not found, it goes back to sleep. If the string is found, it kills the data load job, updates an Oracle table, restarts the data load job and goes back to sleep. I don't believe the program has crashed. I think I have captured most, if not all, of the exceptions. It seems to me that this has something to do with high CPU usage on the NT server. Last time this happened, I noticed that the CPU usage was close to 100% for a long time. Is it possible that NT has swapped my job out and never swaps it back in? If so, how can I prevent this from happening? Thanks! Andrew