amyroh 02/04/04 16:03:04 Modified: catalina/src/share/org/apache/catalina/mbeans MBeanFactory.java Log: Modify removeConnector() to handle Ajp13Connector and CoyoteConnector. Revision Changes Path 1.23 +25 -31 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java Index: MBeanFactory.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- MBeanFactory.java 4 Apr 2002 20:17:47 -0000 1.22 +++ MBeanFactory.java 5 Apr 2002 00:03:03 -0000 1.23 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java,v 1.22 2002/04/04 20:17:47 amyroh Exp $ - * $Revision: 1.22 $ - * $Date: 2002/04/04 20:17:47 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java,v 1.23 2002/04/05 00:03:03 amyroh Exp $ + * $Revision: 1.23 $ + * $Date: 2002/04/05 00:03:03 $ * * ==================================================================== * @@ -63,7 +63,8 @@ package org.apache.catalina.mbeans; -import java.lang.reflect.*; +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; import javax.management.MBeanException; import javax.management.MBeanServer; import javax.management.ObjectName; @@ -116,7 +117,7 @@ * <code>org.apache.catalina.core.StandardServer</code> component.</p> * * @author Amy Roh - * @version $Revision: 1.22 $ $Date: 2002/04/04 20:17:47 $ + * @version $Revision: 1.23 $ $Date: 2002/04/05 00:03:03 $ */ public class MBeanFactory extends BaseModelMBean { @@ -1013,7 +1014,7 @@ MBeanUtils.createObjectName(managed.getDomain(), logger); return (oname.toString()); } - + /** * Create a new UserDatabaseRealm. @@ -1109,34 +1110,27 @@ if (address==null) { address = ""; } + Connector conns[] = (Connector[]) service.findConnectors(); for (int i = 0; i < conns.length; i++) { - if (conns[i] instanceof - org.apache.catalina.connector.http10.HttpConnector) { - String connAddress = - ((org.apache.catalina.connector.http10.HttpConnector)conns[i]).getAddress(); - if (connAddress == null) { - connAddress = ""; - } - int p = ((org.apache.catalina.connector.http10.HttpConnector)conns[i]).getPort(); - String connPort = "" + p; - if (address.equals(connAddress) && port.equals(connPort)) { - // Remove this component from its parent component - service.removeConnector(conns[i]); - break; - } - } else if (conns[i] instanceof - org.apache.catalina.connector.http.HttpConnector) { - String connAddress = - ((org.apache.catalina.connector.http.HttpConnector)conns[i]).getAddress(); - int p = ((org.apache.catalina.connector.http.HttpConnector)conns[i]).getPort(); - String connPort = "" + p; - if (address.equals(connAddress) && port.equals(connPort)) { - // Remove this component from its parent component - service.removeConnector(conns[i]); - break; - } + Class cls = conns[i].getClass(); + Method getAddrMeth = cls.getMethod("getAddress", null); + Object addrObj = getAddrMeth.invoke(conns[i], null); + String connAddress = new String(); + if (addrObj != null) { + connAddress = addrObj.toString(); + } + Method getPortMeth = cls.getMethod("getPort", null); + Object portObj = getPortMeth.invoke(conns[i], null); + String connPort = new String(); + if (portObj != null) { + connPort = portObj.toString(); + } + if (address.equals(connAddress) && port.equals(connPort)) { + // Remove this component from its parent component + service.removeConnector(conns[i]); + break; } }
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>