RFR: 8160950 Agent JAR added to app class loader rather than system class loader when running with -Djava.system.class.loader

serguei.spitsyn at oracle.com serguei.spitsyn at oracle.com
Thu Sep 8 22:02:42 UTC 2016


Mandy,

Thank you for the review.


On 9/8/16 14:55, Mandy Chung wrote:
>> On Sep 7, 2016, at 12:27 PM, serguei.spitsyn at oracle.com wrote:
>>
>> Webrev:
>>    http://cr.openjdk.java.net/~sspitsyn/webrevs/2016/jdk/8160950-JLI-WLS.jdk2/
>
> CustomLoader.java
>    62             File f   = new File(System.getProperty("test.classes", "."), "Agent.class”);
>
> CustomLoader should load Agent.class from Agent.jar that was added after appendToClassPathForInstrumentation is called.

Good suggestion.
This had to be in the first place.


>
> Agent.java
>    43     public static void
>    44     premain(String agentArgs, Instrumentation instrumentation) {
>
> Nit: maybe merge two lines and rename “instrumentation” variable to inst, if you want to shorten the line.

Ok.


>
> The test needs @modules java.instrument; otherwise the test will fail when running in a minimal image without java.instrument module.

Good catch, thanks.

>
> I like David’s suggestion on the simplified error message:
>     "Unable to add %s to system class path\n”

Agreed.


Thanks!
Serguei

>
> Mandy




More information about the serviceability-dev mailing list