Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Please suggest me about ThreadLocal and java.util.TimeZone  RSS feed

woranop chaiyakulvat
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I wrote my web and I test my web.When I started stress test on my web, I found many Threads was blocking by java.util.TimeZone.
My coding want to create many Calendars with "GMT" TimeZone for each request.

Locale LOCALE = Locale.UK;
TimeZone TIMEZONE = TimeZone.getTimeZone("GMT");
Calendar cal = Calendar.getInstance(TIMEZONE, LOCALE);

I try to change to be LOCALE and TIMEZONE to be constant value (final static) But my web are slower.
Should I change this code to used ThreadLocal?
Can every one help to give some suggestions for better solutions?

It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!