public JmxService() throws Exception { this("localhost", NetworkingTestUtils.randomPortAround(28000)); // TODO why this message if the constructor is not actually deprecated, and it seems useful? //logger.warn("use of deprecated default host and port in JmxService"); }
@Override public void init() { sensors().set(Attributes.HOSTNAME, JmxHelperTest.LOCALHOST_NAME); sensors().set(UsesJmx.JMX_PORT, LocalhostMachineProvisioningLocation.obtainPort(PortRanges.fromString( // just doing "40123+" was not enough to avoid collisions (on 40125), // observed on jenkins, not sure why but // maybe something else had a UDP connection we weren't detected, // or the static lock our localhost uses was being bypassed; // this should improve things (2016-01) NetworkingTestUtils.randomPortAround(40000)+"+"))); // only supports no-agent, at the moment config().set(UsesJmx.JMX_AGENT_MODE, JmxAgentModes.NONE); sensors().set(UsesJmx.RMI_REGISTRY_PORT, -1); // -1 means to use the JMX_PORT only ConfigToAttributes.apply(this, UsesJmx.JMX_CONTEXT); } }