Re: Thread.sleep takes a lot of CPU time!
- From: "Ingo R. Homann" <ihomann_spam@xxxxxx>
- Date: Mon, 17 Jul 2006 17:30:27 +0200
Hi
The important point of my posting (sorry, I thought, this was obvious) was, that if an exception occurs, sleep() will never be reached and never executed. If the catch-block does really nothing (even not logging the error), then you do not even see that sleep() is never reached.
You must reorder your statements:
>> public void run()
>> {
>> ...
>>
>> while(true)
>> {
>> try {
>> ...
>> //some set of operations
>> ....
>>
// Thread.sleep() removed here...
>> } catch(Exception e) {
>> // do nothing
>> }
// is now here:
>> Thread.sleep(5*1000*60);
>> }
Ciao,
Ingo
.
- References:
- Thread.sleep takes a lot of CPU time!
- From: Raga
- Re: Thread.sleep takes a lot of CPU time!
- From: Ingo R. Homann
- Re: Thread.sleep takes a lot of CPU time!
- From: Raga
- Thread.sleep takes a lot of CPU time!
- Prev by Date: Re: Applet using non-standard ports
- Next by Date: Re: abstract generic class?
- Previous by thread: Re: Thread.sleep takes a lot of CPU time!
- Next by thread: Re: Thread.sleep takes a lot of CPU time!
- Index(es):
Relevant Pages
|
|