--- old/src/java.base/share/classes/java/net/ServerSocket.java 2018-06-30 14:07:05.522167593 -0700 +++ new/src/java.base/share/classes/java/net/ServerSocket.java 2018-06-30 14:07:05.292167602 -0700 @@ -76,10 +76,11 @@ private boolean oldImpl = false; /** - * Package-private constructor to create a ServerSocket associated with - * the given SocketImpl. + * Creates a server socket with a user-specified SocketImpl. + * + * @param impl the user-specified SocketImpl */ - ServerSocket(SocketImpl impl) { + protected ServerSocket(SocketImpl impl) { this.impl = impl; impl.setServerSocket(this); } @@ -990,6 +991,7 @@ private static Set> options; private static boolean optionsSet = false; + private static boolean rdmaOptionsSet = false; /** * Returns a set of the socket options supported by this server socket. @@ -1004,7 +1006,9 @@ */ public Set> supportedOptions() { synchronized (ServerSocket.class) { - if (optionsSet) { + String currentImpl = impl.getClass().getName(); + boolean rdma = currentImpl.equals("rdma.ch.RdmaSocketImpl"); + if ((rdma && rdmaOptionsSet) || (!rdma && optionsSet)) { return options; } try { @@ -1013,7 +1017,13 @@ } catch (IOException e) { options = Collections.emptySet(); } - optionsSet = true; + if (rdma) { + rdmaOptionsSet = true; + optionsSet = false; + } else { + rdmaOptionsSet = false; + optionsSet = true; + } return options; } }