dims 2002/06/18 08:12:25
Modified: java/src/org/apache/axis/transport/http AxisServlet.java
Log:
- Fix for Bug 9817 (Race condition exists in AxisServlet)
- Remove redundant extra code.
Revision Changes Path
1.115 +21 -32
xml-axis/java/src/org/apache/axis/transport/http/AxisServlet.java
Index: AxisServlet.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/transport/http/AxisServlet.java,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -r1.114 -r1.115
--- AxisServlet.java 17 Jun 2002 18:55:04 -0000 1.114
+++ AxisServlet.java 18 Jun 2002 15:12:24 -0000 1.115
@@ -200,31 +200,33 @@
*/
static public AxisServer getEngine(HttpServlet servlet) throws AxisFault
{
+ AxisServer engine = null;
if (isDebug)
log.debug("Enter: getEngine()");
ServletContext context = servlet.getServletContext();
-
- AxisServer engine = (AxisServer)context.getAttribute(ATTR_AXIS_ENGINE);
- if (engine == null) {
- Map environment = getEngineEnvironment(servlet);
-
- // Obtain an AxisServer by using whatever AxisServerFactory is
- // registered. The default one will just use the provider we
- // passed in, and presumably JNDI ones will use the ServletContext
- // to figure out a JNDI name to look up.
- //
- // The point of doing this rather than just creating the server
- // manually with the provider above is that we will then support
- // configurations where the server instance is managed by the
- // container, and pre-registered in JNDI at deployment time. It
- // also means we put the standard configuration pattern in one
- // place.
- engine = AxisServer.getServer(environment);
- context.setAttribute(ATTR_AXIS_ENGINE, engine);
+ synchronized (servlet) {
+ engine = (AxisServer)context.getAttribute(ATTR_AXIS_ENGINE);
+ if (engine == null) {
+ Map environment = getEngineEnvironment(servlet);
+
+ // Obtain an AxisServer by using whatever AxisServerFactory is
+ // registered. The default one will just use the provider we
+ // passed in, and presumably JNDI ones will use the ServletContext
+ // to figure out a JNDI name to look up.
+ //
+ // The point of doing this rather than just creating the server
+ // manually with the provider above is that we will then support
+ // configurations where the server instance is managed by the
+ // container, and pre-registered in JNDI at deployment time. It
+ // also means we put the standard configuration pattern in one
+ // place.
+ engine = AxisServer.getServer(environment);
+ context.setAttribute(ATTR_AXIS_ENGINE, engine);
+ }
}
- if (isDebug)
+ if (isDebug)
log.debug("Exit: getEngine()");
return engine;
@@ -267,19 +269,6 @@
try
{
AxisEngine engine = getEngine();
- try {
- engine = getEngine();
- } catch (AxisFault fault) {
- res.setContentType("text/html");
- writer.println("<h2>" +
- JavaUtils.getMessage("error00") + "</h2>");
- writer.println("<p>" +
- JavaUtils.getMessage("somethingWrong00") +
- "</p>");
- writer.println("<pre>" + fault.toString() + " </pre>");
- return;
- }
-
ServletContext servletContext =
getServletConfig().getServletContext();