< prev index next >

src/java.base/share/classes/java/net/Socket.java

Print this page

        

@@ -1789,10 +1789,11 @@
         return getImpl().getOption(name);
     }
 
     private static Set<SocketOption<?>> options;
     private static boolean optionsSet = false;
+    private static boolean rdmaOptionsSet = false;
 
     /**
      * Returns a set of the socket options supported by this socket.
      *
      * This method will continue to return the set of options even after

@@ -1803,19 +1804,27 @@
      *
      * @since 9
      */
     public Set<SocketOption<?>> 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 {
                 SocketImpl impl = getImpl();
                 options = Collections.unmodifiableSet(impl.supportedOptions());
             } catch (IOException e) {
                 options = Collections.emptySet();
             }
+            if (rdma) {
+                rdmaOptionsSet = true;
+                optionsSet = false;
+            } else {
+                rdmaOptionsSet = false;
             optionsSet = true;
+            }
             return options;
         }
     }
 }
< prev index next >