Package javax.management

Examples of javax.management.MBeanServer.unregisterMBean()


      protocols.clear();
      memoryDatabases.clear();
      try {
        MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
        mBeanServer.unregisterMBean(onProfiler);
        mBeanServer.unregisterMBean(onServer);
      } catch (Exception e) {
        OLogManager.instance().error(this, "OrientDB Server v" + OConstants.ORIENT_VERSION + " unregisterMBean error.", e);
      }
      Orient.instance().shutdown();
View Full Code Here


            ObjectName name = new ObjectName(getObjectName(category, id));
            Set set = mbs.queryNames(name, null);
            if (set != null && set.isEmpty()) {
                mbs.registerMBean(mBeanInstance, name);
            } else {
                mbs.unregisterMBean(name);
                mbs.registerMBean(mBeanInstance, name);
            }
        } catch (Exception e) {
            log.warn("Error registering a MBean with name ' " + id +
                    " ' and category name ' " + category + "' for JMX management", e);
View Full Code Here

    public void unRegisterMBean(String category, String id) {
        try {
            MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
            ObjectName objName = new ObjectName(getObjectName(category, id));
            if (mbs.isRegistered(objName)) {
                mbs.unregisterMBean(objName);
            }
        } catch (Exception e) {
            log.warn("Error un-registering a  MBean with name ' " + id +
                    " ' and category name ' " + category + "' for JMX management", e);
        }
View Full Code Here

            ObjectName name = new ObjectName(getObjectName(category, id));
            Set set = mbs.queryNames(name, null);
            if (set != null && set.isEmpty()) {
                mbs.registerMBean(mbeanInstance, name);
            } else {
                mbs.unregisterMBean(name);
                mbs.registerMBean(mbeanInstance, name);
            }
        } catch (Exception e) {
            log.warn("Error registering a MBean with name ' " + id +
                    " ' and category name ' " + category + "' for JMX management", e);
View Full Code Here

    public void unRegisterMBean(String category, String id) {
        try {
            MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
            ObjectName objName = new ObjectName(getObjectName(category, id));
            if (mbs.isRegistered(objName)) {
                mbs.unregisterMBean(objName);
            }
        } catch (Exception e) {
            log.warn("Error un-registering a  MBean with name ' " + id +
                    " ' and category name ' " + category + "' for JMX management", e);
        }
View Full Code Here

        {
            invalid = true;  
            MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
            ObjectName nameObj = new ObjectName(mbeanName);
            if (mbs.isRegistered(nameObj))
                mbs.unregisterMBean(nameObj);
            for (ColumnFamilyStore index : indexedColumns.values())
                index.unregisterMBean();
        }
        catch (Exception e)
        {
View Full Code Here

  public static void registerMBean(ObjectName objectName, Object mbean) {
    final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
    if (mbs.isRegistered(objectName)) {
      try {
        LOG.info("unregister: "+objectName);
        mbs.unregisterMBean(objectName);
      } catch (InstanceNotFoundException e) {
        throw new IllegalStateException("mbean " + objectName +
          " failed unregistration", e);
      } catch (MBeanRegistrationException e) {
        throw new IllegalStateException("mbean " + objectName +
View Full Code Here

    // those we have reference to
    final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
    for (ObjectName mBeanObjectName : mBeans) {
      try {
        mbs.unregisterMBean(mBeanObjectName);
      } catch (InstanceNotFoundException e) {
        // this just means someone unregistered our beans already
        // but we're OK with that and it can't cause failure
      }
    }
View Full Code Here

    mBeans.clear();

    // to prevent naming conflicts: let's unreg also possible leftovers (with the same prefix)
    for (ObjectName objectName : mbs.queryNames(new ObjectName(getPackageName(jmxPrefix) + ":name=com.p6spy.*"), null)) {
      try {
        mbs.unregisterMBean(objectName);
      } catch (InstanceNotFoundException e) {
        // this just means someone unregistered the bean earlier than us
        // (quite unprobable, but parallel unreg could happen)
        // but we're OK with that and it can't cause failure
      }
View Full Code Here

    private void unregisterJmx() {
        try {
            if (jmxName != null) {
                MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
                mbs.unregisterMBean(jmxName);
            }
        } catch (InstanceNotFoundException ignore) {
            // NOOP
        } catch (Exception e) {
            log.error("Unable to unregister JDBC pool with JMX", e);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.