luehe 2004/04/06 19:27:47 Modified: catalina/src/share/org/apache/catalina/core StandardContext.java Log: Fixed problem where when replacing global JspServlet with webapp-specific one, the wrapper for the global JspServlet (which had already been stopped and marked unavailable) was still being registered with JMX, because even though the wrapper had been removed from the context's children, it was never removed from the "wrappers" instance field. Replaced all occurrences of "wrappers" with the result of "findChildren()", so that we don't need to maintain two lists of wrapper children. Revision Changes Path 1.124 +18 -18 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.123 retrieving revision 1.124 diff -u -r1.123 -r1.124 --- StandardContext.java 5 Apr 2004 22:40:07 -0000 1.123 +++ StandardContext.java 7 Apr 2004 02:27:47 -0000 1.124 @@ -569,8 +569,6 @@ */ private transient DirContext webappResources = null; - private ArrayList wrappers=new ArrayList(); - private long startupTime; private long startTime; private long tldScanTime; @@ -2315,7 +2313,6 @@ public Wrapper createWrapper() { //log.info( "Create wrapper" ); Wrapper wrapper = new StandardWrapper(); - wrappers.add(wrapper); synchronized (instanceListeners) { for (int i = 0; i < instanceListeners.length; i++) { @@ -3105,9 +3102,10 @@ */ public void removeChild(Container child) { - if (!(child instanceof Wrapper)) + if (!(child instanceof Wrapper)) { throw new IllegalArgumentException (sm.getString("standardContext.notWrapper")); + } super.removeChild(child); @@ -4416,8 +4414,6 @@ // Reset application context context = null; - - wrappers = new ArrayList(); } /** @@ -4523,8 +4519,6 @@ // Reset application context context = null; - wrappers = new ArrayList(); - // This object will no longer be visible or used. try { resetContext(); @@ -5251,16 +5245,23 @@ } - /** JSR77 servlets attribute + /** + * JSR77 servlets attribute * * @return list of all servlets ( we know about ) */ public String[] getServlets() { - int size=wrappers.size(); - String result[]=new String[size]; - for( int i=0; i< size; i++ ) { - result[i]=((StandardWrapper)wrappers.get(i)).getObjectName(); + + String[] result = null; + + Container[] children = findChildren(); + if (children != null) { + result = new String[children.length]; + for( int i=0; i< children.length; i++ ) { + result[i] = ((StandardWrapper)children[i]).getObjectName(); + } } + return result; } @@ -5325,10 +5326,9 @@ broadcaster.sendNotification(notification); } } - for (Iterator it = wrappers.iterator(); it.hasNext() ; ) { - StandardWrapper wrapper=(StandardWrapper)it.next(); - // XXX prevent duplicated registration - wrapper.registerJMX( this ); + Container children[] = findChildren(); + for (int i=0; children!=null && i<children.length; i++) { + ((StandardWrapper)children[i]).registerJMX( this ); } } catch (Exception ex) { log.info("Error registering wrapper with jmx " + this + " " +
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]