On Jun 15, 2009, at 9:32 AM, Christopher Schultz wrote:

On 6/14/2009 5:43 PM, David Blevins wrote:
Regardless of that choice we
will still handle sychronization of instantiation, so
double-check-locking or other things will not be necessary.

NB: DCL does not work in Java. Period.

http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html

There are cases where you /can/ make it work, but let's face it: most
programmers simple cannot be trusted to do it properly. Also, the
techniques are very sensitive to JVM level, etc. so you'd need to have a
different implementation depending on which JVM you were running. Yuk.

Chris, I was referring to the EJB 3.1 Singleton bean type which would free him up from having to write that complicated code you mention.

-David


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

Reply via email to