????Java?????API????JMX????
???????????? ???????[ 2016/2/3 10:42:23 ] ??????????????? Java
???????????JMX
????JMS?????Java?淶??????????ι?????????????????ó?????淶?? ?????????????ó????ó?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Щ???????????????????????????п???????????????????Щ????????????????????С???Щ??????С??
????JMS????????????????淶???к?????ù淶??????????JBoss????SUN??????ù淶????????????????JDK1.5????????????jar?????????jre?У??????????????jar????????Щ??Χ??????赥???????
????????JMX?淶?????????????????????????????????????????????????????????????Tomcat??weblogic??JBOSS?????????????????????JMX??????????Щ??????????????????JMX??
???????JMX????????????????????????????????????檔???????????????????????????????????????????????棨??????WEB?????GUI????????????????????????С????JMX?????????淶????????????????JMX????????????????????????????????????html??????????????
??????????????????????????ó??????????JMX??????.
????????JMX???????????????
????1?????????????????????????????????????????????JMX?淶???????MBean?????MBean??????????java????????????????????淶?????????????????MBean??????????????java???????????????????????????????????????y????????????JMX??淶?????????????????????????????MBean??
????2??????MBean??????MBean?????????
????3??????????????????ЩMBean??
???????????????
????1??????MBean???
????public interface DemoMBean {
????public String getMsg();
????public void setMsg(String msg);
????public void showMsg();
????}
??????????????????MBean??β
????2??????MBean???????
public class Demo implements DemoMBean {
private String msg;
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public void showMsg() {
System.out.println("Hello World?? " + msg);
}
}
????????????????? ???????????MBean????????????б?????Demo??
????3?????Mbean
public class Agent {
public static void main(String[] args) throws Exception {
MBeanServer server = MBeanServerFactory.createMBeanServer();
//????MBean?????
server.registerMBean(new Demo()?? new ObjectName("mybean:name=xxx"));
//???????web?????????????????????MBean???????web????????????????.
//??web server??????????MBean???????????. ??????web?????????????????8082
HtmlAdaptorServer htmlServer = new HtmlAdaptorServer(9999);
server.registerMBean(htmlServer?? new ObjectName("Agent:name=htmlServer"));
//???web???????????????????? http://localhost:9999/ ?????????????ЩMbean
htmlServer.start();
}
}
???????иó??????????????? http://localhost:9999/ ??????????????MBean??????????????????MBean???в?????
???????С??
????????????????????JMX??????????????????JMX??????????JMX???????????????????????????????MBean????
?????????Щ???????????MBean????????? ??????????????????????api??????????ЩMBean?????????MBean?????????????????????????????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11