< prev index next >
src/java.base/share/classes/java/net/Socket.java
Print this page
*** 1789,1798 ****
--- 1789,1799 ----
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,1821 ****
*
* @since 9
*/
public Set<SocketOption<?>> supportedOptions() {
synchronized (Socket.class) {
! if (optionsSet) {
return options;
}
try {
SocketImpl impl = getImpl();
options = Collections.unmodifiableSet(impl.supportedOptions());
} catch (IOException e) {
options = Collections.emptySet();
}
optionsSet = true;
return options;
}
}
}
--- 1804,1830 ----
*
* @since 9
*/
public Set<SocketOption<?>> supportedOptions() {
synchronized (Socket.class) {
! 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 >