RFR (M) CR 8023234: StampedLock serializes readers on writer unlock

Martin Buchholz martinrb at google.com
Wed Aug 21 02:28:35 UTC 2013


If a Reader throws, the test might still pass, since only throwing from the
main thread matters.  See infrastructure in JSR166TestCase, e.g.
threadUnexpectedException.

OTOH, there seems no value in converting exceptions in the main thread to
ISE.  Just declare main to throw Exception or whatever.


On Tue, Aug 20, 2013 at 7:55 AM, Aleksey Shipilev <
aleksey.shipilev at oracle.com> wrote:

>
> > I think it's more readable to use CountDownLatch instead of
> > CyclicBarrier for writerHasLock, because of asymmetric API.
> > Doers call countDown(), waiters call await().
>
> Nope, we need: a) *reusable* primitive, CDL is one-shot, unfortunately;
> b) we need symmetric block, writer should also block on barrier until
> both readers arrive; this makes test much more reliable.
>

You're right that here you need something reusable.  I try to avoid
reusable synchronization constructs, but don't have any obvious suggestion
for how to do that here.



More information about the core-libs-dev mailing list