> From: David kerber [mailto:dcker...@verizon.net]
> Subject: Trouble parsing datetime strings
> 
> Declared at the class level, I have:
> 
>     private static final SimpleDateFormat    sdfFullDateTime = new
> SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" );

Oops.  Read the fine print for SimpleDateFormat:

"Date formats are not synchronized. It is recommended to create separate format 
instances for each thread. If multiple threads access a format concurrently, it 
must be synchronized externally."

Rather than introducing another bottleneck by synchronizing, you may be better 
off keeping separate SDF objects for each request.  If this is your only 
webapp, you could get away with storing one per thread as a ThreadLocal.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


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

Reply via email to