tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marc Saegesser" <>
Subject Question about synchronizing useBean body
Date Mon, 12 Feb 2001 02:44:17 GMT
NOTE:  I sent the following question to jsp-spec-comments but I'm going to
post it here as well to get some additional discussion.

This question came up from my review of open Bugzilla reports against Tocmat
3.2.1 in preparation for the 3.2.2 release.  The bug report can be found at

The spec is not crystal clear on the topic, but given the intended use of
the useBean body I would think the resulting servlet code should be in a
synchronized block.  I have implemented the change but I want to get a
clearing spec interpretation before I commit it.


This question is regarding section 2.13.1 in the JSP 1.1 spec and section
4.1 in the JSP 1.2 spec.  In both cases the section is about the processing
of the useBean standard action.

The specification breaks down the processing of useBean into seven actions.
Action 1, which is about locating an existing bean object, specifically
states that the operation is synchronized for the scope namespace.

Action 7 only happens when a bean instance could not be found.  The body of
the useBean tag is processed as normal JSP text.  There is no mention in
action 7 about synchronization.  A common use of a useBean body (as
indicated in the spec) is to complete the initialization of the bean.

The question, then, is if this body text should be protected inside a
synchronization block like that in action 1?  If it is not synchronized,
then another request that uses the same bean may see that the bean has
already been created (and thus, not execute the body) but the bean it sees
may not have been fully intitialized because the processing of the first
body text may not have completed.

View raw message