public final boolean registerMBean ( final Class < ? > clazz ) { if ( this . mbs != null && clazz != null ) { try { final String fqnName = clazz . getCanonicalName ( ) ; final String domain = fqnName . substring ( 0 , fqnName . lastIndexOf ( ' ' ) ) ; final String type = fqnName . substring ( fqnName . lastIndexOf ( ' ' ) + 1 ) ; final ObjectName objectName = new ObjectName ( String . format ( beanNameFormat , domain , type ) ) ; if ( ! mbs . isRegistered ( objectName ) ) { LaunchingMessageKind . IJMX0004 . format ( objectName ) ; mbs . registerMBean ( clazz . newInstance ( ) , objectName ) ; LaunchingMessageKind . IJMX0005 . format ( objectName ) ; } this . beanNames . add ( objectName ) ; } catch ( Exception e ) { LaunchingMessageKind . EJMX0004 . format ( clazz . getCanonicalName ( ) , e ) ; return false ; } } else { LaunchingMessageKind . EJMX0002 . format ( ) ; return false ; } return true ; }
Try to register standard MBean type in the JMX server