tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: Tag object reuse (pooling) in jsp 2.0?
Date Thu, 23 Jan 2003 01:08:00 GMT

On 21 Jan 2003, Joe Tomcat wrote:

> Date: 21 Jan 2003 05:46:53 -0800
> From: Joe Tomcat <>
> Reply-To: Tomcat Users List <>
> To: Tomcat Users List <>
> Subject: Tag object reuse (pooling) in jsp 2.0?
> The current wisdom on object pooling is "don't do it", with the
> exception of expensive objects like database connections, etc.  Right
> now, jsp uses object pooling of tag objects, in theory to attain higher
> performance.  This might have made sense back in the old days, but now
> must Tag objects are very simple with only a few fields, and can be
> created and GCed very efficiently.  Is tag object pooling going to go
> away with jsp 2.0?

Best way to find out is to go get the spec :-).

For backwards compatibility, the programming requirements on old-style
tags (javax.servlet.jsp.tagext.Tag and friends) remains the same -- you
have to program your tags to operate correctly in a pooled environment.

JSP 2.0 also introduces a new tag API called SimpleTag.  Besides being
much easier to program, you don't need to worry about pooling and reuse of
them; they are created as needed by the container.

There aren't any milestone builds of Tomcat 5 (which implements Servlet
2.4 and JSP 2.0) yet, but it's not all that hard to build from source if
you want to play with this.

> I'm hoping that it will, for two reasons.  First, that will make writing
> tags simpler.  The whole reason we are using Java instead of C++ is
> because in Java we let the GC do the cleanup work for us.  That results
> in much more stable software.  Right now, tags have to be written in
> such a way that they do their own cleanup.  The second reason is that
> tags should have all their fields set in the constructor, perhaps using
> a Map as an argument.  This seems strange but has the advantage that the
> tag object can then be made immutable, which has a large set of
> benefits.
> Opinions?


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message