jmx使用介绍 spring集成HtmlAdaptorServer

2016-06-16 22:01:00
admin
原创 3093
摘要:jmx使用介绍 spring集成HtmlAdaptorServer

一、jmx使用介绍

1、JMX,Java Management Extensions,一个应用系统管理框架;

2、创建普通MBean,接口名称后面必须跟上MBean,实现类名称是接口名称去掉MBean;

3、MBean注册名称的格式:DomainName:property=value[,property2=value2]*

4、HtmlAdaptorServer支持创建MBean,删除MBean,操作MBean;

5、普通mbean:JmxHelloMBean.javaJmxHello.javaJmxHelloAgent.java

6、动态mbean:SimpleDynamic.java

7、依赖下载:jmx-1_2_1-ri.zip

8、访问服务:http://localhost:8080


二、spring集成HtmlAdaptorServer 

代码以及配置:

1、JVMStatMBean.java

2、JVMStat.java

3、applicationContext-beans.xml


常见垃圾回收器:

1、youngGenCollectorNames.add("Copy");
2、youngGenCollectorNames.add("ParNew");
3、youngGenCollectorNames.add("PS Scavenge");

4、oldGenCollectorNames.add("MarkSweepCompact");
5、oldGenCollectorNames.add("PS MarkSweep");
6、oldGenCollectorNames.add("ConcurrentMarkSweep");


关于MemoryUsage:

init约等于xms的值,max约等于xmx的值,used是已经被使用的内存大小,committed是当前可使用的内存大小,包括已使用的,committed>=used。committed不足时jvm向系统申请,若超过max则发生OutOfMemoryError错误。


jconsole访问:

-Dcom.sun.management.jmxremote

-Dcom.sun.management.jmxremote.port=8082

-Dcom.sun.management.jmxremote.ssl=false

-Dcom.sun.management.jmxremote.authenticate=false

发表评论
评论通过审核之后才会显示。