public void registerMBean ( String storageName , int storageId ) { if ( mbeanIsRegistered . compareAndSet ( false , true ) ) { try { final MBeanServer server = ManagementFactory . getPlatformMBeanServer ( ) ; final ObjectName mbeanName = new ObjectName ( getMBeanName ( storageName , storageId ) ) ; if ( ! server . isRegistered ( mbeanName ) ) { server . registerMBean ( new OPerformanceStatisticManagerMBean ( this ) , mbeanName ) ; } else { mbeanIsRegistered . set ( false ) ; OLogManager . instance ( ) . warn ( this , "MBean with name %s has already registered. Probably your system was not shutdown correctly" + " or you have several running applications which use OrientDB engine inside" , mbeanName . getCanonicalName ( ) ) ; } } catch ( MalformedObjectNameException | InstanceAlreadyExistsException | NotCompliantMBeanException | MBeanRegistrationException e ) { throw OException . wrapException ( new OStorageException ( "Error during registration of profiler MBean" ) , e ) ; } } }
Registers JMX bean for current manager .