JDK-8278270 introduces a small regression. If a ServerSocket is closed while 
another thread is blocked in the accept method then the other thread may 
observe isClosed returning false, i.e. code may catch IOException and check 
isClosed before the "closed" flag gets to true.

I've changed the close method to set the "closed" flag before closing the 
underlying impl. This is consistent with the network channels and also 
consistent with async close where the close completes on the thread that was 
blocked in accept. The change also prevents re-attempting the underlying impl 
in the unlikely event that it fails(an area that is completed unspecified). 
Overall I think this is preferable to have add synchronization to isClosed.

-------------

Commit messages:
 - Fix test summary
 - Fix exception message
 - Initial commit

Changes: https://git.openjdk.java.net/jdk/pull/6741/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=6741&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8278339
  Stats: 93 lines in 2 files changed: 85 ins; 7 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/6741.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/6741/head:pull/6741

PR: https://git.openjdk.java.net/jdk/pull/6741

Reply via email to