craigmcc 00/11/16 10:25:22
Modified: src/share/org/apache/tomcat/core Tag: tomcat_32
ContextManager.java
Log:
Correctly shut down *all* contexts (which will trigger the destroy()
method of all initialized servlets being called). Previously, the code
was relying on being able to enumerate over a collection that is being
modified, which is undefined behavior -- and does not work as intended in
many JVMs.
Submitted by: Marc Saegesser <[EMAIL PROTECTED]>
Revision Changes Path
No revision
No revision
1.100.2.19 +3 -5
jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java
Index: ContextManager.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java,v
retrieving revision 1.100.2.18
retrieving revision 1.100.2.19
diff -u -r1.100.2.18 -r1.100.2.19
--- ContextManager.java 2000/11/11 02:56:58 1.100.2.18
+++ ContextManager.java 2000/11/16 18:25:21 1.100.2.19
@@ -466,11 +466,9 @@
/** Will shutdown all contexts
*/
public void shutdown() throws TomcatException {
- Enumeration enum = getContexts();
- while (enum.hasMoreElements()) {
- removeContext((Context)enum.nextElement());
- }
-
+ while (!contextsV.isEmpty()) {
+ removeContext((Context) contextsV.firstElement());
+ }
ContextInterceptor cI[]=getContextInterceptors();
for( int i=0; i< cI.length; i++ ) {
cI[i].engineShutdown( this );