--- old/src/java.base/share/classes/java/net/Socket.java 2018-10-05 14:14:33.037756909 -0700 +++ new/src/java.base/share/classes/java/net/Socket.java 2018-10-05 14:14:32.763756906 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1791,6 +1791,8 @@ private static Set> options; private static boolean optionsSet = false; + private static Set> rdmaOptions; + private static boolean rdmaOptionsSet = false; /** * Returns a set of the socket options supported by this socket. @@ -1805,16 +1807,29 @@ */ public Set> supportedOptions() { synchronized (Socket.class) { - if (optionsSet) { - return options; - } try { SocketImpl impl = getImpl(); - options = Collections.unmodifiableSet(impl.supportedOptions()); + String implName = impl.getClass().getName(); + if (implName.equals("jdk.internal.net.rdma.RdmaSocketImpl")) { + if (rdmaOptionsSet) + return rdmaOptions; + rdmaOptions = Collections.unmodifiableSet( + impl.supportedOptions()); + rdmaOptionsSet = true; + return rdmaOptions; + } else { + if (optionsSet) + return options; + options = Collections.unmodifiableSet( + impl.supportedOptions()); + optionsSet = true; + return options; + } } catch (IOException e) { options = Collections.emptySet(); + rdmaOptions = Collections.emptySet(); } - optionsSet = true; + //should not reach here return options; } }