[crac] RFR: Introduce per-Priority Context with different policies

Anton Kozlov akozlov at openjdk.org
Thu May 18 16:30:20 UTC 2023


On Thu, 18 May 2023 12:23:27 GMT, Radim Vansa <duke at openjdk.org> wrote:

>> A follow-up work for #60:
>> 
>> * Each priority now has a dedicated context, so contextes may provide different policies. CALL_SITE now uses new CriticalUnorderedContext that runs beforeCheckpoint on concurrent registration, fixes [1]. Whether or not CALL_SITE needs to be registered to at all is an open question and out of scope of this PR.
>> * the Global Context reverted from BlockingOrderedContext to OrderedContext, as that may have a huge impact on users. Probably we'll want to expose blocking/criticalUnorderd context along the global one, or at some point expose an implementation. But this is also out of scope of the PR.
>> * hierachy of the Context implementations are cleaned up a bit [2]
>> 
>> The JDKContext is now just a holder of ClaimedFDs, I'll address this in a follow-up that depends on this Context follow-up.
>> 
>> [1] https://github.com/openjdk/crac/pull/60#issuecomment-1545588281
>> [2] https://github.com/openjdk/crac/pull/60#discussion_r1185510445
>
> test/jdk/jdk/crac/ContextOrderTest.java line 67:
> 
>> 65:         var recorder = new LinkedList<String>();
>> 66:         getGlobalContext().register(new MockResource(recorder, null, "regular1"));
>> 67:         JDKResource resource2 = new MockResource(recorder, NORMAL, "jdk-normal");
> 
> Looks like the local vars are not used?

Overlooked Resources are creating strong refs in their constructors.

> test/jdk/jdk/crac/ContextOrderTest.java line 288:
> 
>> 286:         private CreatingResource(List<String> recorder, Priority priority, String id, Priority childPriority) {
>> 287:             super(recorder, priority, id);
>> 288:             this.childContext = (Context<R>) childPriority.getContext(); // XXX
> 
> `// XXX`

Indeed, I feel something wrong with the resulting types in the test, but not sure how to fix.

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

PR Review Comment: https://git.openjdk.org/crac/pull/74#discussion_r1198030533
PR Review Comment: https://git.openjdk.org/crac/pull/74#discussion_r1198028792


More information about the crac-dev mailing list