2009/6/18  <ma...@apache.org>:
> Author: markt
> Date: Thu Jun 18 08:32:29 2009
> New Revision: 785952
>
> URL: http://svn.apache.org/viewvc?rev=785952&view=rev
> Log:
> Add some micro-benchmarks that enable the differences between the Sync and 
> ThreadLocal approach to be compared
>
> Added:
>    tomcat/trunk/test/org/apache/catalina/valves/
>    tomcat/trunk/test/org/apache/catalina/valves/Benchmarks.java
>
> (...)
> +        private ThreadLocal<SimpleDateFormat> yearFormatterLocal =
> +            new ThreadLocal<SimpleDateFormat>() {
> +            protected SimpleDateFormat initialValue() {
> +                return new SimpleDateFormat("yyyy");
> +            }
> +        };
> +        private ThreadLocal<SimpleDateFormat> timeFormatterLocal =
> +            new ThreadLocal<SimpleDateFormat>() {
> +            protected SimpleDateFormat initialValue() {
> +                return new SimpleDateFormat("hh:mm:ss");
> +            }
> +        };
> +

I wonder,
may be we can have a single ThreadLocal that holds some object
that stores all the formatters (maybe with lazy initialization),
instead of wrapping each one individually?

Will it make some difference?


Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to