--- old/src/java.base/share/classes/java/net/Socket.java 2018-06-30 14:07:06.176167567 -0700 +++ new/src/java.base/share/classes/java/net/Socket.java 2018-06-30 14:07:05.873167579 -0700 @@ -1791,6 +1791,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 socket. @@ -1805,7 +1806,9 @@ */ public Set> supportedOptions() { synchronized (Socket.class) { - if (optionsSet) { + String currentImpl = impl.getClass().getName(); + boolean rdma = currentImpl.equals("rdma.ch.RdmaSocketImpl"); + if ((rdma && rdmaOptionsSet) || (!rdma && optionsSet)) { return options; } try { @@ -1814,7 +1817,13 @@ } catch (IOException e) { options = Collections.emptySet(); } - optionsSet = true; + if (rdma) { + rdmaOptionsSet = true; + optionsSet = false; + } else { + rdmaOptionsSet = false; + optionsSet = true; + } return options; } }