RFR(s): 8243451: nsk.share.jdi.Debugee.isJFR_active() is incorrect and corresponsing logic seems to be broken
Erik Gahlin
erik.gahlin at oracle.com
Mon Jun 1 10:55:31 UTC 2020
Hi Fairoz,
What I think you need to do is something like this:
if (className.equals("java.lang.Thread")) {
return !isJfrInitialized();
}
...
private static boolean isJfrInitialized() {
try {
Class<?> clazz = Class.forName("jdk.jfr.FlightRecorder");
Method method = clazz.getDeclaredMethod("isInitialized",
new Class[0]);
return (boolean) method.invoke(null, new Object[0]);
} catch (Exception e) {
return false;
}
}
Erik
On 2020-06-01 12:30, Fairoz Matte wrote:
> Hi Erik,
>
> Thanks for your quick response,
> Below is the updated webrev to handle if jfr module is not present
> http://cr.openjdk.java.net/~fmatte/8243451/webrev.01/
>
> Thanks,
> Fairoz
>
>> -----Original Message-----
>> From: Erik Gahlin
>> Sent: Monday, June 1, 2020 2:31 PM
>> To: Fairoz Matte <fairoz.matte at oracle.com>
>> Cc: serviceability-dev at openjdk.java.net
>> Subject: Re: RFR(s): 8243451: nsk.share.jdi.Debugee.isJFR_active() is incorrect
>> and corresponsing logic seems to be broken
>>
>> Hi Fairoz,
>>
>> If the test needs to run with builds where the JFR module is not present(?), you
>> need to do the check using reflection.
>>
>> If not, looks good.
>>
>> Erik
>>
>>> On 1 Jun 2020, at 10:27, Fairoz Matte <fairoz.matte at oracle.com> wrote:
>>>
>>> Hi,
>>>
>>> Please review this small test infra change to identify at runtime the JFR is
>> active or not.
>>> JBS - https://bugs.openjdk.java.net/browse/JDK-8243451
>>> Webrev - http://cr.openjdk.java.net/~fmatte/8243451/webrev.00/
>>>
>>> Thanks,
>>> Fairoz
More information about the serviceability-dev
mailing list