首页  

JMX之ObjectName     所属分类 jmx 浏览量 1329
ObjectName  Mbean的对象名称

ObjectName 域(domain) + 属性(properties)

ObjectName
java.lang:type=OperatingSystem

java.lang:type=MemoryPool,name=Metaspace

ObjectName模式匹配

*:type=Foo,name=Bar
匹配任意域下的一个确定keys的集合。keys为:type=Foo,name=Bar

d:type=Foo,name=Bar,*
匹配 d 域 下有 keys  type=Foo,name=Bar 加上零个或者多个其他keys

*:type=Foo,name=Bar,*

匹配任意域下有keys type=Foo,name=Bar 加上零个或者多个其他keys

d:type=F?o,name=Bar
d:type=F*o,name=Bar
d:type=Foo,name="B*"

        
        

import javax.management.ObjectName;

public class ObjectNameTest {
	
	public static void main(final String[] args) throws Exception{
		ObjectName objectName1 = new ObjectName("test:key1=value1,key2=value2"); 
		ObjectName objectName2 = new ObjectName("test:key2=value2,key1=value1"); 
		
		System.out.println(objectName1.toString());
		System.out.println(objectName2.toString());
		
		System.out.println(objectName1.equals(objectName2));
		
		
		System.out.println(objectName1.getKeyProperty("key1"));

		System.out.println(objectName1.getKeyProperty("key2"));
		
		System.out.println(objectName1.getKeyPropertyListString());
		System.out.println(objectName2.getKeyPropertyListString());

		System.out.println(objectName1.getCanonicalName());
		System.out.println(objectName1.getCanonicalKeyPropertyListString());
		System.out.println(objectName1.getKeyPropertyList());

	}
	
}

上一篇     下一篇
java线程池系列文章汇总

tomcat参数 acceptCount maxConnections maxThreads

Java中的整数缓存IntegerCache

tomcat之JMXProxyServlet

javap查看字节码

leveldb简介