[crac] RFR: 8357984: [CRaC] Improve new properties installation code

Timofei Pushkin tpushkin at openjdk.org
Thu May 29 07:44:03 UTC 2025


On Thu, 29 May 2025 06:39:02 GMT, Radim Vansa <rvansa at openjdk.org> wrote:

>> Rewrites the code which installs new properties on restore to make it more concise by using direct array iteration and lambdas.
>> 
>> Note that initially the lambdas were removed from this code in #75 because they triggered a resource registration in a blocking context during C/R which led to a deadlock. But as I understand #73 made it possible to use lambdas during C/R.
>> 
>> I also noted that there are no tests for new properties so I added one.
>
> src/java.base/share/classes/jdk/internal/crac/mirror/Core.java line 199:
> 
>> 197:                 String[] pair = prop.split("=", 2);
>> 198:                 AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
>> 199:                     System.setProperty(pair[0], pair[1]);
> 
> Looks like you have omitted the case when `prop` does not contain `=`, we would OOTB here. I guess the code that creates the properties would always add `=` (+ empty string), but let's be on the safe side.

Yes, `=` will always be there: https://github.com/openjdk/crac/blob/9085a4139efd93d937a66c09a35567e0542c5161/src/hotspot/share/runtime/crac_structs.hpp#L139, but OK I'll do a check and add a test.

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

PR Review Comment: https://git.openjdk.org/crac/pull/233#discussion_r2113403638


More information about the crac-dev mailing list