-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chema,

On 11/23/11 1:10 PM, Chema wrote:
>>> The string of the date format is constant. However the
>>> SimpleDateFormat
>> class is not threadsafe, so you will hit intermittant issues when
>> sharing across threads
> 
> Do you mean that read operations (getters) in not-threadsafe
> objects are not an atomic operations and could retrieve "dirty"
> values cause sharing across threads?

As Chuck says, that depends upon the class.

In the case of SimpleDateFormat, there is a Calendar object used
internally with no synchronization, so multiple threads cannot safely
use java.text.SimpleDateFormat without fear of mass confusion.

If you didn't know that, now you do: don't use a shared
SimpleDateFormat in a threaded environment without any kind of protection.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk7PqpQACgkQ9CaO5/Lv0PDragCgrluaNuJ1Xs3tMGvpHauEts7d
VhYAn1vyKtmd/pT1FGzbibXJwlGfvI56
=oo7Q
-----END PGP SIGNATURE-----

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

Reply via email to