private void unregisterProtobufMetadataManagerMBean(GlobalComponentRegistry gcr) { try { ObjectName objName = gcr.getComponent(ProtobufMetadataManager.class).getObjectName(); MBeanServer mBeanServer = JmxUtil.lookupMBeanServer(gcr.getGlobalConfiguration()); JmxUtil.unregisterMBean(objName, mBeanServer); } catch (Exception e) { throw new CacheException("Unable to unregister ProtobufMetadataManager MBean", e); } }
@Start(priority = 7) // Should start before global marshaller public void start() { loadInternalMarshallables(); loadForeignMarshallables(gcr.getGlobalConfiguration()); started = true; if (log.isTraceEnabled()) { log.tracef( "Constant object table was started and contains these externalizer readers: %s", readers); log.tracef("The externalizer writers collection contains: %s", writers); } }
private void registerProtobufMetadataManagerMBean( ProtobufMetadataManager protobufMetadataManager, GlobalComponentRegistry gcr, String cacheManagerName) { GlobalConfiguration globalCfg = gcr.getGlobalConfiguration(); MBeanServer mBeanServer = JmxUtil.lookupMBeanServer(globalCfg); String groupName = "type=RemoteQuery,name=" + ObjectName.quote(cacheManagerName); String jmxDomain = JmxUtil.buildJmxDomain(globalCfg, mBeanServer, groupName); ComponentMetadataRepo metadataRepo = gcr.getComponentMetadataRepo(); ManageableComponentMetadata metadata = metadataRepo .findComponentMetadata(ProtobufMetadataManagerImpl.class) .toManageableComponentMetadata(); try { ResourceDMBean mBean = new ResourceDMBean(protobufMetadataManager, metadata); ObjectName objName = new ObjectName(jmxDomain + ":" + groupName + ",component=" + metadata.getJmxObjectName()); protobufMetadataManager.setObjectName(objName); JmxUtil.registerMBean(mBean, objName, mBeanServer); } catch (Exception e) { throw new CacheException("Unable to register ProtobufMetadataManager MBean", e); } }