On 1:59 PM, Bill Miller wrote:
The problem is obviously that the thread within the Timer needs time to properly shutdown, the non-obvious part is "how long does it need, and how do you detect it's done?". Normally you would do a Thread.join() to ensure a thread has stopped before continuing, but as you mentioned before you don't have access to the true thread instance in this case.
That's how it looks to me. Time and possibly a context switch.
I'd say that the Thread.sleep() is doing the same as a Thread.join() would in this case, the only problem I see is that if your application is intended to run on different hardware the hardcoded 1000ms delay may not be long enough in some situations. :(
Right.
Have you checked to see if there are any methods available to indicate if the timer has completed its shutdown? (My memory is unclear about this and the JavaDoc isn't handy either... maybe there's another object you need to instantiate to control Timer objects??)
Nothing in Timer. Seems like I could potentially create a Thread and roll my own timing mechanism and then interrupt and join the Thread in contextDestroyed but that may be more complexity than is warranted. Might be fun though.
Bill
Thanks. -Terence --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org