RFR: 6964: [Agent] Automatically open base module for accessing Unsafe on JDK 11+ [v2]

Gunnar Morling github.com+28612+gunnarmorling at openjdk.java.net
Sun Nov 15 09:50:54 UTC 2020


On Tue, 10 Nov 2020 22:59:17 GMT, Marcus Hirt <hirt at openjdk.org> wrote:

>> Gunnar Morling has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision:
>> 
>>   6964: Automatically open base module for accessing Unsafe on JDK 11+
>
> agent/src/main/java/org/openjdk/jmc/agent/util/VersionUtils.java line 70:
> 
>> 68: 
>> 69: 		} catch (Exception e) {
>> 70: 			System.out.println("Could not identify Java version. The agent will not work"); //$NON-NLS-1$
> 
> A system exit from a method named determineFeatureVersion seems slightly evil. ;)

Tbh. I just took inspiration from `TypeUtils#getUnsafeDefineClassMethod(Object)`, so I thought it's what should happen. What's the general stance for uncoverable exceptions in the agent? Should the app just run normally, ignoring any errors in the agent? If so, a general catch-all handler in the agent's main method might be useful.

-------------

PR: https://git.openjdk.java.net/jmc/pull/152


More information about the jmc-dev mailing list