public void register ( ZKMBeanInfo bean , ZKMBeanInfo parent ) throws JMException { assert bean != null ; String path = null ; if ( parent != null ) { path = mapBean2Path . get ( parent ) ; assert path != null ; } path = makeFullPath ( path , parent ) ; mapBean2Path . put ( bean , path ) ; mapName2Bean . put ( bean . getName ( ) , bean ) ; if ( bean . isHidden ( ) ) return ; MBeanServer mbs = ManagementFactory . getPlatformMBeanServer ( ) ; ObjectName oname = makeObjectName ( path , bean ) ; try { mbs . registerMBean ( bean , oname ) ; } catch ( JMException e ) { LOG . warn ( "Failed to register MBean " + bean . getName ( ) ) ; throw e ; } }
Registers a new MBean with the platform MBean server .