1 10 package org.mule.management.support; 11 12 import org.apache.commons.logging.Log; 13 import org.apache.commons.logging.LogFactory; 14 import org.mule.util.ClassUtils; 15 16 import javax.management.ObjectName ; 17 import java.lang.reflect.Method ; 18 19 23 public class AutoDiscoveryJmxSupportFactory implements JmxSupportFactory 24 { 25 28 private transient Log logger = LogFactory.getLog(getClass()); 29 30 37 public JmxSupport newJmxSupport() 38 { 39 Class clazz = ObjectName .class; 41 Method method = ClassUtils.getMethod("quote", new Class []{String .class}, clazz); 43 44 final boolean jmxModernAvailable = method == null; 45 final JmxSupport jmxSupport; 46 if (jmxModernAvailable) 48 { 49 jmxSupport = new JmxModernSupport(); 50 } 51 else 52 { 53 jmxSupport = new JmxLegacySupport(); 54 } 55 if (logger.isDebugEnabled()) 56 { 57 logger.debug("JMX support instance is " + jmxSupport); 58 } 59 return jmxSupport; 60 } 61 62 } 63 | Popular Tags |