[crac] RFR: Fix ordering of invocation on Resources [v3]

Radim Vansa duke at openjdk.org
Tue May 2 07:09:46 UTC 2023


On Fri, 28 Apr 2023 12:06:19 GMT, Anton Kozlov <akozlov at openjdk.org> wrote:

>> Radim Vansa has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - More fine-grained synchronization
>>  - Rework context ordering (round 2)
>>    
>>    * call afterRestore even if beforeCheckpoint throws
>>    * registering resource in previous/running context does not trigger exception immediatelly
>>    ** instead this will be one of the recorded exceptions and the resource has a chance to fire next time
>>    * we don't guarantee threads not deadlocking when trying to register a resource, though
>
> src/java.base/share/classes/jdk/crac/impl/AbstractContextImpl.java line 55:
> 
>> 53:         restoreQ.add(resource);
>> 54:         try {
>> 55:             resource.beforeCheckpoint(semanticContext());
> 
> Does this mean a Resource may get another Context and not the one to which it has been registered? This may be very unexpected for the Resource implementation.

Theoretically, the method could do that. However, here the purpose of `semanticContext()` is to pass the context to which it was registered rather than the subcontext where it is stored (but this is an implementation detail that the resource does not know about).

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

PR Review Comment: https://git.openjdk.org/crac/pull/60#discussion_r1182166930


More information about the crac-dev mailing list