protected void registerMBeans ( WebModuleMetaDataImpl webModule , com . ibm . wsspi . adaptable . module . Container container ) { String methodName = "registerMBeans" ; String appName = webModule . getApplicationMetaData ( ) . getName ( ) ; String webAppName = webModule . getName ( ) ; String debugName ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { debugName = appName + " " + webAppName ; } else { debugName = null ; } WebMBeanRuntime mBeanRuntime = webMBeanRuntimeServiceRef . getService ( ) ; if ( mBeanRuntime == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName , "Web Module [ " + debugName + " ]: No MBean Runtime" ) ; } return ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName , "Web Module [ " + debugName + " ]: MBean Runtime" ) ; } } String ddPath = com . ibm . ws . javaee . dd . web . WebApp . DD_NAME ; // This should be obtained by an adapt call. Iterator < IServletConfig > servletConfigs = webModule . getConfiguration ( ) . getServletInfos ( ) ; webModule . mBeanServiceReg = mBeanRuntime . registerModuleMBean ( appName , webAppName , container , ddPath , servletConfigs ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName , "Web Module [ " + debugName + " ]: Registration [ " + webModule . mBeanServiceReg + " ]" ) ; } servletConfigs = webModule . getConfiguration ( ) . getServletInfos ( ) ; while ( servletConfigs . hasNext ( ) ) { IServletConfig servletConfig = servletConfigs . next ( ) ; String servletName = servletConfig . getServletName ( ) ; WebComponentMetaDataImpl wcmdi = ( WebComponentMetaDataImpl ) servletConfig . getMetaData ( ) ; wcmdi . mBeanServiceReg = mBeanRuntime . registerServletMBean ( appName , webAppName , servletName ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName , "Web Module [ " + debugName + " ] Servlet [ " + servletName + " ]: Registration [ " + wcmdi . mBeanServiceReg + " ]" ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , methodName , "Web Module [ " + debugName + " ]: Completed registrations" ) ; } }
Check for the JSR77 runtime and if available use it to register module and servlet mbeans . As a side effect assign the mbean registration to the web module metadata and to the servlet metadata .