remm 01/04/06 16:42:04
Modified: catalina/src/share/org/apache/catalina/core
StandardContext.java
Log:
- Should fix bug 1202, at least when a naming operation involving the ENC
is attempted during the init() call of a servlet which is loaded on startup.
Revision Changes Path
1.50 +43 -4
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java
Index: StandardContext.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- StandardContext.java 2001/04/05 19:30:39 1.49
+++ StandardContext.java 2001/04/06 23:42:04 1.50
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
1.49 2001/04/05 19:30:39 craigmcc Exp $
- * $Revision: 1.49 $
- * $Date: 2001/04/05 19:30:39 $
+ * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
1.50 2001/04/06 23:42:04 remm Exp $
+ * $Revision: 1.50 $
+ * $Date: 2001/04/06 23:42:04 $
*
* ====================================================================
*
@@ -141,7 +141,7 @@
*
* @author Craig R. McClanahan
* @author Remy Maucherat
- * @version $Revision: 1.49 $ $Date: 2001/04/05 19:30:39 $
+ * @version $Revision: 1.50 $ $Date: 2001/04/06 23:42:04 $
*/
public class StandardContext
@@ -2255,6 +2255,13 @@
// Stop accepting requests temporarily
setPaused(true);
+ if (isUseNaming()) {
+ try {
+ ContextBindings.bindThread(this, this);
+ } catch (NamingException e) {
+ }
+ }
+
// Shut down the current version of all active servlets
Container children[] = findChildren();
for (int i = 0; i < children.length; i++) {
@@ -2270,6 +2277,10 @@
}
}
+ if (isUseNaming()) {
+ ContextBindings.unbindThread(this, this);
+ }
+
// Unload sessions to persistent storage, if supported
try {
getManager().unload();
@@ -2355,6 +2366,16 @@
ok = false;
}
+ if (isUseNaming()) {
+ try {
+ ContextBindings.bindThread(this, this);
+ } catch (NamingException e) {
+ log(sm.getString("standardContext.namingInitFailed",
+ getName()));
+ ok = false;
+ }
+ }
+
// Restart our currently defined servlets
for (int i = 0; i < children.length; i++) {
if (!ok)
@@ -2372,6 +2393,10 @@
}
}
+ if (isUseNaming()) {
+ ContextBindings.unbindThread(this, this);
+ }
+
DirContextURLStreamHandler.unbind();
// Start accepting requests again
@@ -3226,6 +3251,16 @@
list.add(wrapper);
}
+ if (isUseNaming()) {
+ try {
+ ContextBindings.bindThread(this, this);
+ } catch (NamingException e) {
+ log(sm.getString("standardContext.namingInitFailed",
+ getName()));
+ ok = false;
+ }
+ }
+
// Load the collected "load on startup" servlets
if (debug >= 1)
log("Loading " + map.size() + " load-on-startup servlets");
@@ -3246,6 +3281,10 @@
ok = false;
}
}
+ }
+
+ if (isUseNaming()) {
+ ContextBindings.unbindThread(this, this);
}
DirContextURLStreamHandler.unbind();