示例#1
0
 private BeanProxy()
 {
     try
     {
         Type jmx = Type.GetType("javax.management.JMX");
         this._newMXBeanProxy = Jmx.GetMethod("newMXBeanProxy", typeof(MBeanServerConnection), typeof(ObjectName), typeof(Type));
     }
     catch (Exception e) when(e is ClassNotFoundException || e is NoSuchMethodException)
     {
         throw new Exception(e);
     }
 }
        private void RegisterJMXSources(DiagnosticsReporter reporter)
        {
            Optional <JmxDump> jmxDump;

            if (_pid == NO_PID)
            {
                jmxDump = _jmxDumper.JMXDump;
            }
            else
            {
                jmxDump = _jmxDumper.getJMXDump(_pid);
            }
            jmxDump.ifPresent(jmx =>
            {
                reporter.RegisterSource("threads", Jmx.threadDump());
                reporter.RegisterSource("heap", Jmx.heapDump());
                reporter.RegisterSource("sysprop", Jmx.systemProperties());
                reporter.RegisterSource("env", Jmx.environmentVariables());
                reporter.RegisterSource("activetxs", Jmx.listTransactions());
            });
        }