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

Martin,

Martin Gainty wrote:
> after discussing a few scenarios I came upon the idea of
> volatile is to be used as a default declarator (if only for speed..)

Volatile can do nothing but /decrease/ the speed of variable access.
Actually, most JVMs do nothing when you declare something as "volatile".
It's basically a deprecated concept in Java.

If the JVM did what it was /supposed/ to do, then every access of the
particular variable would have to go back to global memory and not the
thread's cache of data (with which you cannot interact). This can only
serve to slow things down.

> ThreadLocal is to be used for complex DataObjects whose size may
> 'grow' over time in this way ThreadLocal guarantees proper
> initialisation of the entire object Lighter (primarily primitive such
> as int,double) objects may live in memory as volatile

As far as I'm concerned, ThreadLocal variables should only be used when
your application is designed in such a way that you must "cheat" to pass
data from one method to another instead of actually passing them as
method arguments.

ThreadLocal has nothing to do with the way objects are stored in memory.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFzQ149CaO5/Lv0PARAv6QAJ0TJoJMDClf/2JeiFJJk6KbKDXDEQCgwmnn
lMDX6zJ7aSkJI8i7J3XL4+E=
=20GD
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to