================ mbean info =======================
497799
public String getHeapMemoryUsage() {
        MemoryUsage memoryUsage = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
        return JsonUtils.marshalToString(memoryUsage);
    }
342184
public BeanInfo getBeanInfo() {
        if (mBeanInfo == null) {
            try { 
                mBeanInfo = getTeaToolsUtils().getBeanInfo(mType);
            }
            catch (Exception e) {
                return null;
            }
        }

        return mBeanInfo;
    }
1080336
private JSONArray emitOperations(ObjectName objName) throws Exception {
        MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
        MBeanInfo mBeanInfo = mBeanServer.getMBeanInfo(objName);
        JSONArray ar = new JSONArray();

        MBeanOperationInfo[] operations = mBeanInfo.getOperations();
        for (MBeanOperationInfo operation : operations) {
            JSONObject obj = new JSONObject();
            obj.put("name", operation.getName());
            obj.put("description", operation.getDescription());
            obj.put("returnType", operation.getReturnType());
            obj.put("impact", operation.getImpact());

            JSONArray params = new JSONArray();
            for (MBeanParameterInfo param : operation.getSignature()) {
                JSONObject p = new JSONObject();
                p.put("name", param.getName());
                p.put("type", param.getType());
                params.put(p);
            }
            obj.put("params", params);
            ar.put(obj);
        }
        return ar;
    }
1188370
public MBeanOperationInfo[] getOperationsInfo(ObjectName name) throws JMException {
		checkClientConnected();
		try {
			return mbeanConn.getMBeanInfo(name).getOperations();
		} catch (Exception e) {
			throw createJmException("Problems getting bean information from " + name, e);
		}
	}
318826
void registerMBean(Configuration conf) {
    // We wrap to bypass standard mbean naming convention.
    // This wraping can be removed in java 6 as it is more flexible in
    // package naming for mbeans and their impl.
    StandardMBean bean;
    try {
      versionBeanName = VersionInfo.registerJMX("NameNode");
      myFSMetrics = new FSNamesystemMetrics(conf, this);
      bean = new StandardMBean(this, FSNamesystemMBean.class);
      mbeanName = MBeanUtil.registerMBean("NameNode", "FSNamesystemState", bean);
    } catch (NotCompliantMBeanException e) {
      e.printStackTrace();
    }

    LOG.info("Registered FSNamesystemStatusMBean");
  }
171382
public static void registerMbean(MBeanServer server, ModelMBean mbean, ObjectName name) {
        try {
            synchronized(LOCK) {
                if(server.isRegistered(name))
                    JmxUtils.unregisterMbean(server, name);
                server.registerMBean(mbean, name);
            }
        } catch(Exception e) {
            logger.error("Error registering mbean:", e);
        }
    }
408105
private void inspectMBean(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException
   {
      String name = request.getParameter("name");

      if (trace)
         log.trace("inspectMBean, name=" + name);

      try
      {
         MBeanData data = getMBeanData(name);
         request.setAttribute("mbeanData", data);

         RequestDispatcher rd = this.getServletContext().getRequestDispatcher("/inspectmbean.jsp");
         rd.forward(request, response);
      }
      catch (Exception e)
      {
         throw new ServletException("Failed to get MBean data", e);
      }
   }
837764
@SuppressWarnings("unused")
    private void printServerInfo() {
        Context ctx;
        try{
            ctx = new InitialContext();
            MBeanServer server = (MBeanServer)ctx.lookup("java:comp/env/jmx/runtime");
            ObjectName service = new ObjectName("com.bea:Name=RuntimeService," +
                  "Type=weblogic.management.mbeanservers.runtime.RuntimeServiceMBean");
            ObjectName domainMBean = (ObjectName) server.getAttribute(service,
                "DomainConfiguration");
            ObjectName[] servers = (ObjectName[]) server.getAttribute(domainMBean,
                    "Servers");
            for (ObjectName one : servers) {
                String name = (String)server.getAttribute(one, "Name");
                String address = (String)server.getAttribute(one, "ListenAddress");
                Integer port = (Integer)server.getAttribute(one, "ListenPort");
                System.out.println("SERVER: " + name + " on " + address + ":" + port);
                ObjectName machine = (ObjectName)server.getAttribute(one, "Machine");
                ObjectName nodeManager = (ObjectName)server.getAttribute(machine, "NodeManager");
                // above line need WLS admin!!!
                address = (String)server.getAttribute(machine, "ListenAddress");
                System.out.println(" - hostname: " + address);
            }
            if (ctx!=null) return;
        }catch(Exception ex){
            ex.printStackTrace();
        }
    }
293800
private static void register(ObjectName objectName, Object mbean) {
    MBeanServer server = ManagementFactory.getPlatformMBeanServer();
    try {
      if (!server.isRegistered(objectName)) {
        server.registerMBean(mbean, objectName);
      }
    } catch (InstanceAlreadyExistsException
        | MBeanRegistrationException | NotCompliantMBeanException e) {
      throw new CacheException("Error registering " + objectName, e);
    }
  }
325014
private void readMbean() {
        int i = 0;
        for (GarbageCollectorMXBean bean : mxBeans) {
            GCStats stat = (GCStats) iStatsList.get(i);
            stat.update(bean.getCollectionCount(), bean.getCollectionTime());
            i++;
        }
    }
362191
private void displayMBeans(HttpServletRequest request, HttpServletResponse response) 
      throws ServletException, IOException
   {
      Iterator mbeans;

      try
      {
         mbeans = getDomainData();
      }
      catch (Exception e)
      {
         throw new ServletException("Failed to get MBeans", e);
      }

      request.setAttribute("mbeans", mbeans);
      RequestDispatcher rd = this.getServletContext().getRequestDispatcher("/displaymbeans.jsp");
      rd.forward(request, response);
   }
1337505
private void initMBean()  {
        try {
            registerMBean(this,getObjectName());
        } catch (InstanceAlreadyExistsException exp) {
            // This is no problem, since this MBeanServerHandlerMBean holds only global information
            // with no special state (so all instances of this MBean behave similar)
            // This exception can happen, when multiple servlets get registered within the same JVM
        } catch (MalformedObjectNameException e) {
            // Cannot happen, otherwise this is a bug. We should be always provide our own name in correct
            // form.
            throw new IllegalStateException("Internal Error: Own ObjectName " + getObjectName() + " is malformed",e);
        } catch (NotCompliantMBeanException e) {
            // Same here
            throw new IllegalStateException("Internal Error: " + this.getClass().getName() + " is not a compliant MBean",e);
        }
    }
1222434
private MBeanServer lookupJolokiaMBeanServer() {
        MBeanServer server = ManagementFactory.getPlatformMBeanServer();
        try {
            return server.isRegistered(JOLOKIA_MBEAN_SERVER_ONAME) ?
                    (MBeanServer) server.getAttribute(JOLOKIA_MBEAN_SERVER_ONAME, "JolokiaMBeanServer") :
                    null;
        } catch (JMException e) {
            throw new IllegalStateException("Internal: Cannot get Jolokia MBeanServer via JMX lookup: " + e, e);
        }
    }
442715
JavaInformations collectJavaInformations() throws IOException {
		final URL jvmUrl = new URL(url.toString() + '&' + HttpParameter.PART + '=' + HttpPart.JVM);
		final List<JavaInformations> list = collectForUrl(jvmUrl);
		return list.get(0);
	}
1070582
private MBeanSampler makeMBeanSampler(Node sample) throws Exception {
		String delayString = selectParameterFromNode(sample, "delay", "60");
		int delay = Integer.parseInt(delayString);

		String initialDelayString = selectParameterFromNode(sample,
				"initialdelay", "0");
		int initialDelay = Integer.parseInt(initialDelayString);

		String sampleDMax = selectParameterFromNode(sample, "dmax", "0");

		MBeanSampler mBeanSampler = new MBeanSampler(initialDelay, delay,
				processName);

		NodeList mBeans = getXmlNodeSet("mbean", sample);
		for (int j = 0; j < mBeans.getLength(); j++) {
			Node mBean = mBeans.item(j);
			String mBeanName = selectParameterFromNode(mBean, "name", null);
			List<MBeanAttribute> attributes = getAttributesForMBean(mBean,
					sampleDMax);
			for (MBeanAttribute mBeanAttribute : attributes) {
				addMBeanAttributeToSampler(mBeanSampler, mBeanName,
						mBeanAttribute);
			}
		}
		return mBeanSampler;
	}
82919
@Override
	public final void register( ObjectName name , Object mBean ) throws JMSException
	{
		log.debug("Registering object " + name);
		try
		{
			this.mBeanServer.registerMBean(mBean, name);
		}
		catch (Exception e)
		{
			throw new FFMQException("Cannot register MBean", "JMX_ERROR", e);
		}
	}
291400
private MBeanConstructorInfo[] getConstructorInfo() {
        final List<MBeanConstructorInfo> infoList = new ArrayList<>();

        if (type != null) {
            for (Constructor constructor : type.getConstructors()) {
                infoList.add(new MBeanConstructorInfo(constructor.toGenericString(), constructor));
            }
        }

        return infoList.toArray(new MBeanConstructorInfo[infoList.size()]);
    }