atom feed3 messages in edu.oswego.cs.concurrency-interestRe: [concurrency-interest] The parts ...
FromSent OnAttachments
Martin GrajcarOct 17, 2017 2:02 pm 
Martin BuchholzOct 17, 2017 2:11 pm 
Doug LeaOct 17, 2017 4:53 pm 
Subject:Re: [concurrency-interest] The parts of the ReentrantReadWriteLock hold no reference to it
From:Martin Grajcar (
Date:Oct 17, 2017 2:02:01 pm

The parts of the ReentrantReadWriteLock holding no reference to it may lead to a situation where the ReentrantReadWriteLock gets GC'ed while its read and write locks are still in use. This is alright unless the ReentrantReadWriteLock is weakly cached as e.g., in Guava Striped, where it has lead to the bug

I'd suggest to add a reference to the enclosing class, e.g., by removing the static modifier. As all these objects are lightweight and not meant to have millions of instances, the cost is negligible. The advantage is decreased chance of buggy user code and avoiding lengthy workarounds like 8afa3630f0.

The cost benefit ratio seems to be good.