Thanks for the great answer!
Best Regards
/David

Niall Pemberton wrote:
My understanding is that servlet containers are free to use whatever
pooling strategy they like and AFAIK Tomcat pools tags with the same
attribute values which is why it doesn't call release() or the setters
for the attributes. Its up to the container to decide the pooling
strategy and when to call release() and the tags attribute setters.
AFAIK the only thing you can be sure of is that the lifecycle methods
are always called (i.e. doStartTag(), doEndTag() etc).

Where Struts tags have had issues in the past with pooling is when
some sort of state was determined and cached in an instance variable
and reset in the release() method. These type of issues were resolved
by always resetting the cached value in the doStartTag() method
(rather than in the release() method).

  http://svn.apache.org/viewvc?view=rev&revision=165158

At the end of the day when release() and the property/attribute
setters are called is down to the servlet container and its the
containers job to ensure that the tag has the right attribute values
when the lifecycle methods are called.

Niall

On 8/24/06, David Gagnon <[EMAIL PROTECTED]> wrote:
Hi all,

  I'm upgrading my old struts right now and several years ago I ran into
the problem that since Tomcat has a TagPool and reuse tags, the state of
the tag wasn't reseted beetween usage.  I looked into the new version of
struts and I cannot find how the tag is resetted between usage.

I looked into tomcat in the TagHandlerPool.reuse() and the release()
function is not called at the end of each utilization but only when the
tag is not used anymore (to be garbage collected).  So how Struts reset
is tag between utilisation to avoid using the properties setted in the
previous utilisation.

Thanks for your help on this!
Best Regards
/David

/**
* Adds the given tag handler to this tag handler pool, unless this tag * handler pool has already reached its capacity, in which case the tag
     * handler's release() method is called.
     *
     * @param handler Tag handler to add to this tag handler pool
     */
    public void reuse(Tag handler) {
        synchronized( this ) {
            if (current < (handlers.length - 1)) {
                handlers[++current] = handler;
                return;
            }
        }
        // There is no need for other threads to wait for us to release
        handler.release();
    }




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to