diff -r be617b8c4427 -r fa6bd0992104 jdk/src/share/classes/sun/nio/ch/AsynchronousServerSocketChannelImpl.java --- a/jdk/src/share/classes/sun/nio/ch/AsynchronousServerSocketChannelImpl.java Thu Mar 14 14:45:55 2013 +0100 +++ b/jdk/src/share/classes/sun/nio/ch/AsynchronousServerSocketChannelImpl.java Thu Mar 14 13:46:15 2013 -0700 @@ -63,6 +63,8 @@ // set true when accept operation is cancelled private volatile boolean acceptKilled; + // set true when exclusive binding is on and SO_REUSEADDR is emulated + private boolean isReuseAddress; AsynchronousServerSocketChannelImpl(AsynchronousChannelGroupImpl group) { super(group.provider()); @@ -186,7 +188,14 @@ try { begin(); - Net.setSocketOption(fd, Net.UNSPEC, name, value); + if (name == StandardSocketOptions.SO_REUSEADDR && + Net.useExclusiveBind()) + { + // SO_REUSEADDR emulated when using exclusive bind + isReuseAddress = (Boolean)value; + } else { + Net.setSocketOption(fd, Net.UNSPEC, name, value); + } return this; } finally { end(); @@ -203,6 +212,12 @@ try { begin(); + if (name == StandardSocketOptions.SO_REUSEADDR && + Net.useExclusiveBind()) + { + // SO_REUSEADDR emulated when using exclusive bind + return (T)Boolean.valueOf(isReuseAddress); + } return (T) Net.getSocketOption(fd, Net.UNSPEC, name); } finally { end();