RFR: 8044135 Add API to start JMX agent from attach framework

Staffan Larsen staffan.larsen at oracle.com
Tue Jun 10 07:09:32 UTC 2014


On 10 jun 2014, at 08:30, David Holmes <david.holmes at oracle.com> wrote:

> Hi Staffan,
> 
> A few general comments:
> 
> VirtualMachine.java:
> 
> - Can/should these references be links to external docs?
> 
> _See the online documentation for "Monitoring and Management Using JMX Technology" for further details._

Good suggestion. I have tried adding links in a similar way to the JVMTI links in the same file.

> 
> startManagementAgent(Properties agentProperties) should specify what happens when agentProperties is null: NPE, IAE, no-op ? (Current implementation throws NPE)

I changed the spec and implementation to throw IAE.

> 
> ---
> 
> LocalVirtualMachine.java needs copyright year update.

Fixed.

> 
> ---
> 
> SimpleProvider.java (also needs copyright update)
> 
> Do the empty methods not generate a javac warning regarding it not being possible to throw IOException? You can drop the throws IOException as it is okay to throw fewer exceptions than the super method you are overriding.

Fixed.

An updated webrev is here: http://cr.openjdk.java.net/~sla/8044135/webrev.01/

This version also has updates to test files that used management-agent.jar: 
  test/sun/management/jmxremote/bootstrap/JvmstatCountersTest.java
  test/sun/management/jmxremote/bootstrap/LocalManagementTest.java
  test/sun/management/jmxremote/bootstrap/TestManager.java
  test/sun/management/jmxremote/startstop/JMXStartStopTest.java

I also too the liberty of fixing some warnings in those files.

Thanks,
/Staffan


> 
> ---
> 
> Cheers,
> David
> 
> 
> On 10/06/2014 5:03 AM, Staffan Larsen wrote:
>> This is the first part in a two-part series of removing the management-agent.jar and replacing its functionality with APIs in the attach framework. In this change I have added the new APIs, a later change will remove management-api.jar.
>> 
>> management-agent.jar is the java agent that is used with the attach API to start the JMX agent in a target VM. It's the approach used in JDK 6 to start JMX in a running VM and predates the "jcmd ManagementAgent.start" command added in 7uX.
>> 
>> management-agent.jar will be problematic when we move to a modular JDK in JDK 9 and should be replaced by a "real" API. So this change adds two methods to VirtualMachine in the attach framework for starting either a local or a remote management agent.
>> 
>> webrev: http://cr.openjdk.java.net/~sla/8044135/webrev.00/
>> bug: https://bugs.openjdk.java.net/browse/JDK-8044135
>> 
>> Thanks,
>> /Staffan
>> 



More information about the serviceability-dev mailing list