Java 8 StandardMBean - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 StandardMBean class.

This code example shows how to use the following methods:
  @Override 
  public void start() { 
    MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
    try { 
      ObjectName on = new ObjectName(domain+":Name="+getName());
      StandardMBean mbean = new StandardMBean(accessStatsImpl, StatisticalView.class);
      if (mbs.isRegistered(on)) {
          mbs.unregisterMBean(on);
      } 
      mbs.registerMBean(mbean, on);
      super.start(); 
    } catch (Exception e) {
      addError("Failed to create mbean", e);
    } 
  } 
   
  @Override 
  public void stop() { 
    super.stop(); 
    try { 
6
CodeRank
This code example shows how to use the following methods:
            Class<T> mbeanInterface,
            ObjectName name) {
        try { 
            MBeanServer mbs = getMBeanServer();
            if (!mbs.isRegistered(name)) {
                final StandardMBean adapter = new StandardMBean(mbean, mbeanInterface);
                mbs.registerMBean(adapter,
                        name);
            } 
        } catch (Exception e) {
            logger.error("Unable to register mbean " + name + " into the platform MBean Server", e);
        } 
    } 
 
    public static synchronized void unregisterMBeanFromServer(ObjectName name) {
        try { 
            MBeanServer mbs = getMBeanServer();
            mbs.unregisterMBean(name);
        } catch (Exception e) {
            logger.error("Exception unregistering mbean: " + name, e);
6
CodeRank
This code example shows how to use the following methods:
    private static final Log logger = LogFactory.getLog(MetricsRegistry.class);
 
    public static void registerMBeans(@Nonnull MixServerMetrics metrics, int port) {
        final StandardMBean mbean;
        try { 
            mbean = new StandardMBean(metrics, MixServerMetricsMBean.class);
        } catch (NotCompliantMBeanException e) {
            logger.error("Unexpected as GridNodeMetricsMBean: " + metrics.getClass().getName(), e);
            return; 
        } 
        final MBeanServer server = ManagementFactory.getPlatformMBeanServer();
        final ObjectName name = makeMBeanName("hivemall", MixServerMetricsMBean.class.getSimpleName(), "port="
                + port);
        try { 
            server.registerMBean(mbean, name);
            logger.info("Registered MBean: " + name);
        } catch (Exception e) {
            logger.error("Failed registering mbean: " + name, e);
        } 
    } 
6
CodeRank
This code example shows how to use the following methods:
 
        // register BlueprintMetadataMBean to MBean server 
        LOGGER.debug("Registering bundle metadata monitor with MBeanServer: {} with name: {}", 
                    mbeanServer, blueprintMetadataName);
        try { 
            StandardMBean blueprintMetadata = new StandardMBean(new BlueprintMetadata(bundleContext), BlueprintMetadataMBean.class);
            mbeanServer.registerMBean(blueprintMetadata, blueprintMetadataName);
        } catch (InstanceAlreadyExistsException e) {
            LOGGER.debug("Cannot register BlueprintMetadataMBean"); 
        } catch (MBeanRegistrationException e) {
            LOGGER.error("Cannot register BlueprintMetadataMBean", e);
        } catch (NotCompliantMBeanException e) {
            LOGGER.error("Cannot register BlueprintMetadataMBean", e);
        } 
    } 
 
    protected void deregisterMBeans(MBeanServer mbeanServer) {
        // unregister BlueprintStateMBean from MBean server 
        try { 
            mbeanServer.unregisterMBean(blueprintStateName);
5
CodeRank
This code example shows how to use the following methods:
			summaryMBean = new SummaryMBeanImpl<M>(this, mbeanClass, typeName);
 
			Hashtable<String, String> props = new Hashtable<String, String>();
			props.put("type", typeName + "Summary");
			ObjectName on = new ObjectName(domainMbean.getName(), props);
			StandardMBean realMBean = new StandardMBean(summaryMBean, SummaryMBean.class);
			domainMbean.getMBeanServer().registerMBean(realMBean, on);
		} catch (InstanceAlreadyExistsException e) {
			// logger.log(Level.INFO, "Summary MBean already exists, reuse old one"); 
			throw e;
		} catch (Exception e) {
			e.printStackTrace();
			logger.log(Level.SEVERE, "Exception initializing MBeanGroupManager: " + e.toString(), e);
		} 
	} 
 
	/** 
	 * This returns the JMXServer to use for registering mbeans. The first time that it's called it also registers the 
	 * Summary MBean for this group 
	 *  
5
CodeRank
This code example shows how to use the following methods:
    @Reference(referenceInterface = MBeanServer.class, bind = "bindMBeanServer", unbind = "unbindMBeanServer") 
    private final ValidatingReference<MBeanServer> mbeanServer = new ValidatingReference<MBeanServer>();
 
    @Activate 
    void activate() throws Exception {
        StandardMBean mbean = new StandardMBean(this, ClusterServiceManagerMBean.class);
        JMXUtils.registerMBean(mbean, mbeanServer.get(), OBJECT_NAME);
        activateComponent(); 
    } 
 
    @Deactivate 
    void deactivate() throws Exception {
        deactivateComponent(); 
        JMXUtils.unregisterMBean(mbeanServer.get(), OBJECT_NAME);
    } 
 
    @Override 
    public List<String> getEnsembleContainers() {
        assertValid(); 
        return clusterService.get().getEnsembleContainers();
4
CodeRank
This code example shows how to use the following methods:
    @Reference(referenceInterface = MBeanServer.class, bind = "bindMBeanServer", unbind = "unbindMBeanServer") 
    private final ValidatingReference<MBeanServer> mbeanServer = new ValidatingReference<MBeanServer>();
 
    @Activate 
    void activate() throws Exception {
        StandardMBean mbean = new StandardMBean(this, ClusterBootstrapManagerMBean.class);
        JMXUtils.registerMBean(mbean, mbeanServer.get(), OBJECT_NAME);
        activateComponent(); 
    } 
 
    @Deactivate 
    void deactivate() throws Exception {
        deactivateComponent(); 
        JMXUtils.unregisterMBean(mbeanServer.get(), OBJECT_NAME);
    } 
 
    static CreateEnsembleOptions getCreateEnsembleOptions(RuntimeProperties sysprops, Map<String, Object> options) {
        String username = (String) options.remove("username");
        String password = (String) options.remove("password");
        String role = (String) options.remove("role");
4
CodeRank
This code example shows how to use the following methods:
This code example shows how to use the following methods:
	public static ObjectName getObjectName() throws MalformedObjectNameException {
		return new ObjectName("net.matlux:name=Nrepl");
	} 
 
	private static void registerMBean(MBeanServer mbs, ObjectName objectName, NreplMBean nreplServer) throws InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException {
		StandardMBean mbean = new StandardMBean(nreplServer, NreplMBean.class, false);
		mbs.registerMBean(mbean, objectName);
	} 
 
	private MBeanRegistration() { 
	} 
 
} 
4
CodeRank
This code example shows how to use the following methods:
		StandardMBean  mbean = null;
		ConfigMBean bean = null;
		try { 
            MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
            bean = new BaseConfigMBean(config);           
            mbean = new StandardMBean(bean, ConfigMBean.class);
            mbs.registerMBean(mbean, getJMXObjectName(config, bean));
        } catch (NotCompliantMBeanException e) {
            throw new RuntimeException(
                    "NotCompliantMBeanException", e);
        } catch (InstanceAlreadyExistsException e) {
            throw new RuntimeException( "InstanceAlreadyExistsException", e);
        } catch (MBeanRegistrationException e) {
            throw new RuntimeException(
                   "MBeanRegistrationException", e);
        } catch (Exception e) {
        	throw new RuntimeException(
                    "registerConfigMbeanException", e);
		} 
		return bean;
3
CodeRank
See Code Examples for Java 8 StandardMBean Methods: