@Override public void init() { super.init(); new JmxSupport(this, null).recommendJmxRmiCustomAgent(); }
/** constructs a JMX URL suitable for connecting to the given entity, being smart about JMX/RMI vs JMXMP */ public static String toJmxUrl(EntityLocal entity) { String url = entity.getAttribute(UsesJmx.JMX_URL); if (url != null) { return url; } else { new JmxSupport(entity, null).setJmxUrl(); url = entity.getAttribute(UsesJmx.JMX_URL); return Preconditions.checkNotNull(url, "Could not find URL for "+entity); } }
/** * Return any JVM arguments required, other than the -D defines returned by {@link #getJmxJavaSystemProperties()} */ protected List<String> getJmxJavaConfigOptions() { List<String> result = new ArrayList<String>(); if (isJmxEnabled()) { result.addAll(new JmxSupport(getEntity(), getRunDir()).getJmxJavaConfigOptions()); } return result; }
public void installJmxSupport() { if (isJmxEnabled()) { newScript("JMX_SETUP_PREINSTALL").body.append("mkdir -p "+getRunDir()).execute(); new JmxSupport(getEntity(), getRunDir()).install(); } }
/** * Return the configuration properties required to enable JMX for a Java application. * * These should be set as properties in the {@code JAVA_OPTS} environment variable when calling the * run script for the application. */ protected Map<String, ?> getJmxJavaSystemProperties() { MutableMap.Builder<String, Object> result = MutableMap.<String, Object> builder(); if (isJmxEnabled()) { new JmxSupport(getEntity(), getRunDir()).applyJmxJavaSystemProperties(result); } return result.build(); }