1 16 17 package org.springframework.jmx.export.naming; 18 19 import java.util.Hashtable ; 20 21 import javax.management.MalformedObjectNameException ; 22 import javax.management.ObjectName ; 23 24 import org.springframework.jmx.support.ObjectNameManager; 25 import org.springframework.util.ClassUtils; 26 import org.springframework.util.ObjectUtils; 27 28 38 public class IdentityNamingStrategy implements ObjectNamingStrategy { 39 40 public static final String TYPE_KEY = "type"; 41 42 public static final String HASH_CODE_KEY = "hashCode"; 43 44 45 49 public ObjectName getObjectName(Object managedBean, String beanKey) throws MalformedObjectNameException { 50 String domain = managedBean.getClass().getPackage().getName(); 51 52 Hashtable keys = new Hashtable (); 53 keys.put(TYPE_KEY, ClassUtils.getShortName(managedBean.getClass())); 54 keys.put(HASH_CODE_KEY, ObjectUtils.getIdentityHexString(managedBean)); 55 56 return ObjectNameManager.getInstance(domain, keys); 57 } 58 59 } 60 | Popular Tags |