tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kris Schneider <>
Subject Re: Terminating Timer Thread Gracefully
Date Tue, 12 Jul 2011 13:59:31 GMT
On Tue, Jul 12, 2011 at 7:59 AM, Caldarale, Charles R
<> wrote:
>> From: Terence M. Bandoian []
>> Subject: Terminating Timer Thread Gracefully
>> Finally, in contextDestroyed, I inserted a call to
>> Thread.sleep after canceling the timer and the error
>> message disappeared.
> You should be able to do a Thread.join() using the timer's Thread object rather than

But Timer doesn't expose its thread. An alternative would be use
something like Executors.newSingleThreadScheduledExecutor() to get a
ScheduledExecutorService. The executor can be used to schedule a
Runnable with a fixed rate or delay. When the context is destroyed,
shutdown the executor and await its termination.

>  - Chuck

Kris Schneider

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message