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

Radim Vansa duke at openjdk.org
Thu May 4 10:27:49 UTC 2023


> * keeps the original handling of exceptions: afterRestore is called even if beforeCheckpoint throws
> * allows to register a resource in a context that did not start beforeCheckpoint invocations yet
> * registering resource in previous/running context fails the checkpoint but does not trigger exception immediately
>    * instead this will be one of the recorded exceptions and the resource has a chance to fire next time
> * allowed registration of resources can be invoked from other thread without deadlock; illegal registration can deadlock, though

Radim Vansa has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision:

 - Fix javadoc and minor refactoring
 - Merge branch 'crac' into context_order
 - 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
 - Fix docs & package
 - Fix ordering of invocation on Resources
   
   * When Context.beforeCheckpoint throws, invoke Context.afterRestore
     anyway (otherwise some resources stay in suspended state).
   * Handle Resource.beforeCheckpoint triggering a registration of another
     resource
   ** Do not cause deadlock when registering from another thread
   ** Global resource can register JDKResource
   ** JDKResource can register resource with higher priority
   ** Other registrations are prohibited

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

Changes:
  - all: https://git.openjdk.org/crac/pull/60/files
  - new: https://git.openjdk.org/crac/pull/60/files/1f2c7b39..eafdb841

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=crac&pr=60&range=03
 - incr: https://webrevs.openjdk.org/?repo=crac&pr=60&range=02-03

  Stats: 253 lines in 10 files changed: 97 ins; 102 del; 54 mod
  Patch: https://git.openjdk.org/crac/pull/60.diff
  Fetch: git fetch https://git.openjdk.org/crac.git pull/60/head:pull/60

PR: https://git.openjdk.org/crac/pull/60


More information about the crac-dev mailing list