[crac] RFR: RCU Lock - RW lock with very lightweight read- and heavyweight write-locking [v5]

Radim Vansa duke at openjdk.org
Thu Apr 13 13:36:17 UTC 2023


On Thu, 13 Apr 2023 13:20:20 GMT, Anton Kozlov <akozlov at openjdk.org> wrote:

>> Radim Vansa has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Add synchronized context
>
> src/java.base/share/classes/jdk/crac/RCULock.java line 141:
> 
>> 139:      * @param readCriticalMethods List of signatures for methods invoked in the read-critical section.
>> 140:      */
>> 141:     public RCULock(String[] readCriticalMethods) {
> 
> It's a big question, why (from the interface point of view) the lock should know methods in which it can be used.
> 
> The second tier question, why the method names are String[] and not Method[] at least.

There's no point in asking 'why'. Interface is there to specify a contract. You declare the methods, and then the implementation fulfills the contract. And you already know why from the point of implementation.

There is another constructor that accepts `Method[]`, being able to specify the signature is just an option if it's more convenient.

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

PR Review Comment: https://git.openjdk.org/crac/pull/58#discussion_r1165530405


More information about the crac-dev mailing list