struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 2214] - ActionServlet uses double-check idiom which is broken
Date Sat, 10 Nov 2001 14:17:51 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2214>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2214

ActionServlet uses double-check idiom which is broken

husted@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|craig.mcclanahan@sun.com    |struts-
                   |                            |dev@jakarta.apache.org



------- Additional Comments From husted@apache.org  2001-11-10 06:17 -------
Any comments on this? Multi-threading is not my strong suit, and we don't 
have a unit test for this ;-)

It seems to come down to 

    /**
     * Return an action-class specific lock object
     */
    protected Object getActionInstanceLock(String actionClass) {
        synchronized(actionInstanceLocks) {
            Object lock = actionInstanceLocks.get(actionClass);
            if (lock == null) {
                lock = new Object();
                actionInstanceLocks.put(actionClass, lock);
            }
            return lock;
        }
    }

// ...

        Object lock = getActionInstanceLock(actionClass);
        synchronized(lock)
{ 

// ... check for the action instance and create one if needed

}

--
To unsubscribe, e-mail:   <mailto:struts-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-dev-help@jakarta.apache.org>


Mime
View raw message