8196787: (ch) Moving network channels to use j.u.c locks

Pavel Rappo pavel.rappo at oracle.com
Mon Feb 5 16:38:58 UTC 2018

This seems to be out of sync (no pun intended) with the writeLock becoming a
j.u.c.Lock and previous locks/unlocks on it.

   821         readLock.lock();
   822         try {
-> 823             synchronized(writeLock) {
   824                 synchronized (stateLock) {
   825                     if (!isConnected() || !isOpen())

> On 5 Feb 2018, at 16:27, Alan Bateman <Alan.Bateman at oracle.com> wrote:
> I have a number of patches in the works that re-work some of the locking in the NIO networking channels and also split the blocking and non-blocking code paths. Part of the motivation is the complexity/overhead dealing with async close and interrupt of blocking operations, another part is preliminary work to prepare the implementations for fibers.
> To get started, I'd like to replace the read/write locks used in the networking channels to use j.u.c. locks. The changes are easy to review:
>    http://cr.openjdk.java.net/~alanb/8196787/webrev/
> There are a few small clean-ups in the patch, this is mostly to keep as much noise out of the follow-up changes. The dropping of the ready parameter from the native checkConnect is clean-up as the readyToConnect flag (dates from 1.4) isn't always reliable to use.
> -Alan

More information about the nio-dev mailing list