TomcatExpert

Thread pooling and TimeZone.setDefault()

posted by SpringSource on May 20, 2010 12:10 PM

Multiple applications inside a single container will pollute threads with wrong Time Zone information.

Running multiple applications in a single container that rely on the TimeZone.getDefault() method will cause problems where the time zone can not be reset inside the thread.  For instance, if one application calls TimeZone.setDefault("GMT"), it will affect the TimeZone (or ZoneInfo) instance over the entire thread.  If a second application is then run on that thread, it will pick up the default set by the previous container. 

There is not much Tomcat since this particular problem lies in the JVM. With this said, there are couple of options, however:

1. Run each app on its own Tomcat instance
2. Write a valve/filter that resets the default timezone.  Unfortunately there is not a way to divide the thread pool and assign them per application.

Option 1 would be the recommended and simple solution and use option 2 as the fallback.


 

For more than 10 years, SpringSource employees have been supporting Apache technologies, with unparalleled experience and commitment to the Apache Software Foundation. More than 400 of the Fortune 500 count on SpringSource to support their mission-critical business applications. Leaders of the Apache Software Foundation, including Board Members, work at SpringSource and dedicate a significant amount of time further developing the Apache Tomcat open source project. Over the last 2 years, 95% of the issues fixed in the Apache Tomcat project were fixed by SpringSource engineers. For more information on how SpringSource can help your enterprise, see the SpringSource website, or call 800/444-1935.

Comments

David

twitter followers I understand this column. I realize You put a many of struggle to found this story. I admire your process. favorites

Re: ergebnis stv wahl

nice one buddy thank for sharing
www.gmail.com thank you

Essay writing service is

Essay writing service is wonderful writing company for making all types of papers

Thanks for writing such a

Thanks for writing such a good article, I stumbled onto your blog and read a few post. I like your style of writing... dentalimplantstoronto

You possess lifted an

You possess lifted an essential offspring..Blesss for using..I would want to study better latest transactions from this blog..preserve posting.. venetian blinds

I can recommend primarily

I can recommend primarily decent and even responsible tips, as a result view it: Toronto escorts

Post new comment

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.