public static void registerContainerMBean(String containerName,IJSpaceContainer container){
  MBeanServer mBeanServer=getMBeanServer(containerName);
  if (mBeanServer == null)   return;
  if (m_MBeansRepository.containsKey(containerName))   return;
  try {
    JMXSpaceContainer mbean=new JMXSpaceContainer(container,CONTAINER_MBEAN_DESCR_URL);
    ObjectName objName=ObjectNameFactory.buildObjectName(DEFAULT_DOMAIN,mbean.getType(),containerName);
    m_MBeansRepository.put(containerName,mBeanServer.registerMBean(mbean,objName));
  }
 catch (  InstanceAlreadyExistsException e) {
    if (_logger.isLoggable(Level.CONFIG)) {
      _logger.config("Container MBean is already registered for <" + containerName + ">");
    }
  }
catch (  Exception ex) {
    if (_logger.isLoggable(Level.WARNING)) {
      _logger.log(Level.WARNING,"Failed to register MBean for <" + containerName + "> container.",ex);
    }
  }
  if (_logger.isLoggable(Level.CONFIG)) {
    _logger.config("\nContainer <" + containerName + "> MBean was registered successfully.\n");
  }
}

public static void registerContainerMBean ( String containerName , IJSpaceContainer container ) { MBeanServer mBeanServer = getMBeanServer ( containerName ) ; if ( mBeanServer == null ) return ; if ( m_MBeansRepository . containsKey ( containerName ) ) return ; try { JMXSpaceContainer mbean = new JMXSpaceContainer ( container , CONTAINER_MBEAN_DESCR_URL ) ; ObjectName objName = ObjectNameFactory . buildObjectName ( DEFAULT_DOMAIN , mbean . getType ( ) , containerName ) ; m_MBeansRepository . put ( containerName , mBeanServer . registerMBean ( mbean , objName ) ) ; } catch ( InstanceAlreadyExistsException e ) { if ( _logger . isLoggable ( Level . CONFIG ) ) { _logger . config ( "Container MBean is already registered for <" + containerName + ">" ) ; } } catch ( Exception ex ) { if ( _logger . isLoggable ( Level . WARNING ) ) { _logger . log ( Level . WARNING , "Failed to register MBean for <" + containerName + "> container." , ex ) ; } } if ( _logger . isLoggable ( Level . CONFIG ) ) { _logger . config ( "\nContainer <" + containerName + "> MBean was registered successfully.\n" ) ; } }
create management bean for jspace container .
