You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2001/11/10 15:17:51 UTC
DO NOT REPLY [Bug 2214] -
ActionServlet uses double-check idiom which is broken
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: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>