private AbstractProfileMBeanImpl createAndRegisterProfileMBean ( String profileName , ProfileTableImpl profileTable ) throws ManagementException { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "createAndRegisterProfileMBean( profileTable = " + profileTable + " , profileName = " + profileName + " )" ) ; } try { ProfileSpecificationComponent component = profileTable . getProfileSpecificationComponent ( ) ; Constructor < ? > constructor = component . getProfileMBeanConcreteImplClass ( ) . getConstructor ( Class . class , String . class , ProfileTableImpl . class ) ; final AbstractProfileMBeanImpl profileMBean = ( AbstractProfileMBeanImpl ) constructor . newInstance ( component . getProfileMBeanConcreteInterfaceClass ( ) , profileName , profileTable ) ; profileMBean . register ( ) ; // add a rollback action to unregister the mbean TransactionalAction rollbackAction = new TransactionalAction ( ) { public void execute ( ) { try { profileMBean . unregister ( ) ; } catch ( Throwable e ) { logger . error ( e . getMessage ( ) , e ) ; } } } ; sleeTransactionManagement . getTransactionContext ( ) . getAfterRollbackActions ( ) . add ( rollbackAction ) ; return profileMBean ; } catch ( Throwable e ) { throw new ManagementException ( e . getMessage ( ) , e ) ; } }
Creates and registers a profile mbean for the specified object .