tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 43790] - concurrent access issue on TagHandlerPool
Date Thu, 10 Jan 2008 11:25:01 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43790>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43790


michael.mao@achievo.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED




------- Additional Comments From michael.mao@achievo.com  2008-01-10 03:25 -------
(In reply to comment #1)
> I am marking this as an enhancement.
> Could you clarify how your solution is different to the 
PerThreadTagHandlerPool?
> If you attach our proposed solution to this bug then it will be reviewed for
> inclusion.

With threadLocal variable, we don't need to create object pool again.
There is the following code snippet for your reference.
    private ThreadLocal<Tag> perThread = new ThreadLocal<Tag>();
    protected void init(ServletConfig config) 
    {
    }
    public Tag get(Class handlerClass) throws JspException 
    {
    	Tag jspTag = perThread.get();
    	if (jspTag == null)
    	{
            try 
            {
            	jspTag = (Tag) handlerClass.newInstance();
            	perThread.set(jspTag);
            } 
            catch (Exception e) 
            {
                throw new JspException(e.getMessage(), e);
            }
		}
    	else
    	{
    		//System.out.println("Reset tag:" + handlerClass);
    		jspTag.release();
    	}
    	return jspTag;
    }
    public void reuse(Tag handler) 
    {
    	//Do nothing.
    }
    public void release() 
    {
    	//Do nothing.
    }


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

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


Mime
View raw message