remm 2003/06/22 10:14:25
Modified: catalina/src/share/org/apache/catalina/core
StandardContext.java
Log:
- Oops, my earlier change on the order of JMX registration was incorrect.
I noticed things were wrong because the mapper welcome file processing
was broken after a webapp reload (quite annoying).
- The JMX name is now constructed (the piepline init needs it, otherwise valves
and stuff will never be unregistered, leaking objects), but the actual
registration occurs after the context start is done.
- Code cleanup.
Revision Changes Path
1.67 +23 -21
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.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- StandardContext.java 20 Jun 2003 21:18:45 -0000 1.66
+++ StandardContext.java 22 Jun 2003 17:14:24 -0000 1.67
@@ -4015,8 +4015,8 @@
// Initialize associated mapper
mapper.setContext(getPath(), welcomeFiles, resources);
- // JMX registration
- registerJMX();
+ // Set JMX object name for proper pipeline registration
+ preRegisterJMX();
// Start our child containers, if any
Container children[] = findChildren();
@@ -4127,8 +4127,8 @@
setAvailable(false);
}
- // Wrappers JMX registration
- registerWrappersJMX();
+ // JMX registration
+ registerJMX();
// Notify our interested LifecycleListeners
lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null);
@@ -5031,33 +5031,35 @@
return oname;
}
- private void registerJMX() {
+ private void preRegisterJMX() {
try {
- StandardHost hst=(StandardHost)getParent();
- if( oname==null || oname.getKeyProperty("j2eeType")==null ) {
-
- oname=createObjectName(hst.getDomain(), hst.getJmxName());
- log.debug("Checking for " + oname );
- if(! Registry.getRegistry().getMBeanServer().isRegistered(oname))
- {
- controller=oname;
- Registry.getRegistry().registerComponent(this,oname, null);
- }
+ StandardHost host = (StandardHost) getParent();
+ if ((oname == null)
+ || (oname.getKeyProperty("j2eeType") == null)) {
+ oname = createObjectName(host.getDomain(), host.getJmxName());
+ controller = oname;
}
- } catch( Exception ex ) {
+ } catch(Exception ex) {
log.info("Error registering ctx with jmx " + this + " " +
- oname + " " + ex.toString(), ex );
+ oname + " " + ex.toString(), ex );
}
}
- private void registerWrappersJMX() {
+ private void registerJMX() {
try {
- for( Iterator it=wrappers.iterator(); it.hasNext() ; ) {
+ if (log.isDebugEnabled()) {
+ log.debug("Checking for " + oname );
+ }
+ if(! Registry.getRegistry().getMBeanServer().isRegistered(oname)) {
+ controller = oname;
+ Registry.getRegistry().registerComponent(this, oname, null);
+ }
+ for (Iterator it = wrappers.iterator(); it.hasNext() ; ) {
StandardWrapper wrapper=(StandardWrapper)it.next();
// XXX prevent duplicated registration
wrapper.registerJMX( this );
}
- } catch( Exception ex ) {
+ } catch (Exception ex) {
log.info("Error registering wrapper with jmx " + this + " " +
oname + " " + ex.toString(), ex );
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]