https://issues.apache.org/bugzilla/show_bug.cgi?id=49985

Sergey Vorobyev <sergeyvorob...@google.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |

--- Comment #2 from Sergey Vorobyev <sergeyvorob...@google.com> 2010-10-01 
04:06:16 EDT ---
First and most obviously, two or more Long/BigInteger objects could be
allocated. It's not dangerous, but not good.

Second consider following:

Thread1:
protected Number getInteger() {
        if (this.number == null) {
            try {
->              this.number = new Long(this.image); // this.number isn't null,
but not fully complete.

Thread2:
protected Number getInteger() {
        if (this.number == null) { // break, because this.number isn't null
already.
            ...
        }
->      return number; // publish not fully complete object link.
    }

For more reasons see
http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html
(It's about dcl, but about lazy initialization generally two. First example
become to this code exactly)

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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

Reply via email to