Re: Timer gets stuck
- From: "Mike Schilling" <mscottschilling@xxxxxxxxxxx>
- Date: Thu, 09 Feb 2006 01:52:47 GMT
<hagarwal@xxxxxxxxxxxxxxxxxx> wrote in message
news:1139331011.761058.296150@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I have a TimerTask that downloads e-mails from a POP service, and
processes them. I am using a Timer class with initial delay and period
of 5 seconds.
I have observed that at times, the Timer gets "stuck", as in it fails
to execute the task and then I have to restart the application for the
Timer to be working again.
I initially thought that this was because I did not specify the timeout
in the my connection to the POP service, but aren't the subsequent
executions supposed to be independant of each other, so even if one
execution is halted because of a bad POP service, the next execution
should work just fine.
No, a java.util.Timer runs all of its tasks on a single thread. If one task
hangs, no others will run. Also, if an exception escapes the task, that
will kill the thread and no more tasks will run on it, ever.
.
- References:
- Timer gets stuck
- From: hagarwal
- Timer gets stuck
- Prev by Date: Re: Book still relevant? "Essential Java Style"
- Next by Date: Re: Linux to WindowsXP TCP
- Previous by thread: Re: Timer gets stuck
- Next by thread: xml byte array
- Index(es):
Relevant Pages
|