tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Luehe <Jan.Lu...@sun.com>
Subject [PATCH] Tag pooling/reuse in Jasper 2 (RESENT)
Date Fri, 07 Jun 2002 17:52:40 GMT
[I am resending this patch, since my original posting apparently did not
make it to the list.]

Attached is a patch implementing tag pooling and tag reuse for Jasper 2.
I am also attaching a new class org.apache.jasper.runtime.TagHandlerPool
implementing a tag handler pool (org.apache.jasper.util.SimplePool
is not being leveraged, since we want our pool's get() method to
encapsulate the logic of instantiating a new tag handler if the pool
is empty, and its reuse() method to encapsulate the logic of calling
the handler's release() method if the pool is full).


Tag pooling/reuse is implemented as follows:

- Every custom tag is assigned a tag handler pool, based on its full tag name
and attribute set.

- Tag handler pools are declared as servlet instance variables, so
that they can be shared across page invocations.

- Tag handler pools are instantiated with a
yet-to-be-made-configurable capacity at servlet construction time
(current default capacity is 5).

- When a tag handler is required, it is retrieved from the appropriate
tag handler pool. If the pool is empty, a new tag handler is instantiated and
returned.

- When a tag handler is no longer needed, it is returned to the appropriate
pool. It is added to the pool, unless the pool has already reached its
capacity, in which case the tag handler's release() method is called.

- The servlet's destroy() method enumerates the servlet's tag handler
pools and calls the release() method of every available tag handler.


Outstanding issues:
- Make tag handler pool capacity configurable.
- Optimize tag reuse in the body of iteration tags.


Thanks,


Jan

Mime
View raw message