2014-03-10 10:36 GMT+01:00 Mark Thomas <ma...@apache.org>: > > I'm not convinced these write locks are needed, there should be no write > > concurrency in the first place. > > The explanation for why the lock is required is in the comments in the > writeInternal() method. The lock is definitely required. The issue > described in that comment was observed when running the Autobahn > WebSocket test suite. >
Actually, it could also happen with NIO2, so the lock on writeInternal is justified then. > > > If the consensus is to keep the lock to try to avoid the most serious > > corruption issues, then in the onWritePossible method only the call to > > writeInternal would need to be locked, not the rest. > > It does look like the lock could be narrowed but I'm not sure it can be > quite that narrow. The lock is effectively protecting buffer from > concurrent access (some comments to that effect would not hurt). > > I'll add some more comments to that class and see what can be done to > narrow that scope of the writeLock. > > Ok. Rémy