Yeah, that was my original impression of the current servlet
implementation.  In JSP 1.1, most tag implementations assumed that
release() was called after each tag invocation (lots of my original tags
were written that way).  Now there's no method that's called automatically
after each tag (other than doEndTag(), that is :).

So I think we can safely say that release() is out.

- Morgan

On Tue, 19 Jun 2001, Hans Bergsten wrote:

> Sean Rohead wrote:
> > 
> > I'm confused.  The closeConnection tag will definately *not* be called in
> > the presence of exceptions under *any* version of the spec, so the solution
> > using release() is no worse under implementations of 1.1 that don't call
> > release in a finally block.  However, in 1.2, it is mandated by the spec to
> > be called in a finally block.  The spec states:
> > 
> > Once all invocations on the tag handler are completed, the release method is
> > invoked on it. Once a release method is invoked all properties, including
> > parent
> > and pageContext, are assumed to have been reset to an unspecified value. The
> > page compiler *guarantees* that release() will be invoked on the Tag handler
> > before
> > the handler is released to the GC. (jsp-1_2-pfd-spec, page 164, emphasis
> > added)
> > 
> > And also:
> > 
> > public void release ()
> > 
> > Called on a Tag handler to release state. The page compiler *guarantees*
> > that
> > JSP page implementation objects will invoke this method on *all* tag
> > handlers,
> > but there may be multiple invocations on doStartTag and doEndTag in
> > between. (jsp-1_2-pfd-spec, page 166, emphasis added)
> > [...]
> 
> The problem is that release() may not be called until the web application
> is shut down if the container implements pooling of tag handlers. The
> spec only guarantees that it is called at some time, but it explicitly
> says that the tag handler may be used multiple times ("multiple invocations 
> on doStartTag and doEndTag") before release() is called. Hence, release() is 
> not the method you want to use for cleaning up that must take place after 
> *each* use of the tag handler. 
> 
> The tag handler life cycle is pretty messy, but the JSP 1.2 spec at least 
> tries to make it it clearer than JSP 1.1 (there are a number of contradictions 
> in JSP 1.1, so look at JSP 1.2 instead).
> 
> Also see the other mail I sent about this. I believe the idea I present
> there is a workable approach for dealing with connections.
> 
> Hans
> -- 
> Hans Bergsten         [EMAIL PROTECTED]
> Gefion Software               http://www.gefionsoftware.com
> Author of JavaServer Pages (O'Reilly), http://TheJSPBook.com
> 

Reply via email to