[crac] RFR: Synchronize concurrent clean() in PhantomCleanableRef
Radim Vansa
duke at openjdk.org
Fri May 12 14:48:05 UTC 2023
On Fri, 12 May 2023 13:50:34 GMT, Radim Vansa <duke at openjdk.org> wrote:
> Fixes failures in RefQueueTest and JarFileFactoryCacheTest.
I think that you won't avoid waiting for the cleanup thread - there would have to be a point in time where we'd switch a global (or per-resource?) flag to enter the blocking behavior (cannot be on all the time, because the checkpoint may never happen), and then wait for the in-flight resources to complete. It would be possible to achieve the synchronization through switching the flag on in the cleaner thread, but that only means waiting for it as well.
All in all it seems much more complicated. Are you aware of any pros? Maybe self-deadlocking rather than deadlock in 2 threads (that's why I had to add the eager initialization for FileDispatcherImpl, C/R was already at CLEANERS when the cleaner thread tried to initialize it and register with NORMAL priority) - if that's any advantage.
-------------
PR Comment: https://git.openjdk.org/crac/pull/70#issuecomment-1545859013
More information about the crac-dev
mailing list