File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes My Program Sometimes Would Not Wake Up Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "My Program Sometimes Would Not Wake Up" Watch "My Program Sometimes Would Not Wake Up" New topic
Author

My Program Sometimes Would Not Wake Up

Andrew Kwong
Ranch Hand

Joined: Dec 11, 2001
Posts: 40
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


Andrew
Karthikraj Magapu
Greenhorn

Joined: Dec 04, 2001
Posts: 9
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
Andrew Kwong
Ranch Hand

Joined: Dec 11, 2001
Posts: 40
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: My Program Sometimes Would Not Wake Up