• 大小: 5.02MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-09-17
  • 语言: Java
  • 标签: Jmx  demo  jmxdemo  Jmx实例  

资源简介

java实现Jmx实例,jmxdemo项目源码下载

资源截图

代码片段和文件信息

package com;

import java.util.HashMap;
import java.util.Map;

import javax.management.MBeanServerConnection;
import javax.management.objectName;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;

public class Client {
public static void main(String[] args) {
try {
String ip = “127.0.0.1“;
int port = 40000;
String user = “admin“;
String password = “admin“;
//创建jmx连接
JMXServiceURL jmxUrl = new JMXServiceURL(“service:jmx:rmi://“ + ip + “:“ + port + “/jndi/rmi://“ + ip + “:“ + port + “/server“);
Mapject> map=new HashMapject>();
// map.put(“jmx.remote.protocol.provider.pkgs“ “org.logicblaze.lingo.jmx.remote.provider“);
JMXConnector jmxConn=JMXConnectorFactory.connect(jmxUrlmap);
//获得MBean服务连接
MBeanServerConnection mbsConn=jmxConn.getMBeanServerConnection();
String defaultDedomain=mbsConn.getDefaultDomain();
objectName objname= new objectName(defaultDedomain + “:name=mytest“);
object[] para={“yang“};//参数名
String[] paraType={“java.lang.String“};//参数类型
object str=mbsConn.invoke(objname “getInfo“ para paraType);//调用服务端的方法
System.out.println(“rerult:“ + str.toString());
} catch (Exception e) {
e.printStackTrace();

}
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件        1821  2013-07-30 14:20  jmxdemo\.classpath
     目录           0  2013-07-30 16:08  jmxdemo\.myeclipse\
     文件         294  2007-04-18 08:59  jmxdemo\.mymetadata
     文件        1009  2013-07-30 16:06  jmxdemo\.project
     文件          55  2013-07-30 14:20  jmxdemo\.settings\org.eclipse.core.resources.prefs
     文件        2544  2013-07-30 16:06  jmxdemo\bin\com\Client.class
     文件        3444  2013-07-30 16:07  jmxdemo\bin\com\Server.class
     文件        1504  2013-07-30 16:06  jmxdemo\bin\com\SimpleStandard.class
     文件         364  2013-07-30 16:06  jmxdemo\bin\com\SimpleStandardMBean.class
     文件         623  2013-07-30 16:06  jmxdemo\bin\com\mbean\My.class
     文件         164  2013-07-30 16:06  jmxdemo\bin\com\mbean\MyMBean.class
     文件      234052  2007-04-17 14:36  jmxdemo\lib\activeio-core-3.0-beta4.jar
     文件     1344310  2007-04-17 14:36  jmxdemo\lib\activemq-core-4.0.2.jar
     文件       71790  2007-04-17 14:36  jmxdemo\lib\activemq-ra-4.0.2.jar
     文件      329586  2007-04-17 14:36  jmxdemo\lib\backport-util-concurrent-2.1.jar
     文件       38015  2007-04-17 14:36  jmxdemo\lib\commons-logging-1.0.4.jar
     文件       33528  2007-04-17 14:36  jmxdemo\lib\geronimo-activation_1.0.2_spec-1.1.jar
     文件      135618  2007-04-17 14:36  jmxdemo\lib\geronimo-connector-1.1.jar
     文件       40520  2007-04-17 14:36  jmxdemo\lib\geronimo-core-1.1.jar
     文件       19759  2007-04-17 14:36  jmxdemo\lib\geronimo-ejb_2.1_spec-1.0.1.jar
     文件       33226  2007-04-17 14:36  jmxdemo\lib\geronimo-j2ee-connector_1.5_spec-1.0.jar
     文件       30732  2007-04-17 14:36  jmxdemo\lib\geronimo-j2ee-jacc_1.0_spec-1.0.1.jar
     文件       19259  2007-04-17 14:36  jmxdemo\lib\geronimo-j2ee-management_1.0_spec-1.0.1.jar
     文件      180453  2007-04-17 14:36  jmxdemo\lib\geronimo-javamail_1.3.1_spec-1.1.jar
     文件       31397  2007-04-17 14:36  jmxdemo\lib\geronimo-jms_1.1_spec-1.0.1.jar
     文件       14637  2007-04-17 14:36  jmxdemo\lib\geronimo-jta_1.0.1B_spec-1.0.1.jar
     文件       82923  2007-04-17 14:36  jmxdemo\lib\geronimo-servlet_2.4_spec-1.0.1.jar
     文件      274026  2007-04-17 14:36  jmxdemo\lib\geronimo-system-1.1.jar
     文件       75585  2007-04-17 14:36  jmxdemo\lib\geronimo-transaction-1.1.jar
     文件      114978  2007-04-17 14:36  jmxdemo\lib\lingo-1.3.jar
     文件      358085  2007-04-17 14:36  jmxdemo\lib\log4j-1.2.12.jar
............此处省略7个文件信息

评论

共有 条评论