< prev index next >
src/java.base/share/classes/java/net/ServerSocket.java
Print this page
*** 74,87 ****
* Are we using an older SocketImpl?
*/
private boolean oldImpl = false;
/**
! * Package-private constructor to create a ServerSocket associated with
! * the given SocketImpl.
*/
! ServerSocket(SocketImpl impl) {
this.impl = impl;
impl.setServerSocket(this);
}
/**
--- 74,88 ----
* Are we using an older SocketImpl?
*/
private boolean oldImpl = false;
/**
! * Creates a server socket with a user-specified SocketImpl.
! *
! * @param impl the user-specified SocketImpl
*/
! protected ServerSocket(SocketImpl impl) {
this.impl = impl;
impl.setServerSocket(this);
}
/**
*** 988,997 ****
--- 989,999 ----
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 server socket.
*
* This method will continue to return the set of options even after
*** 1002,1021 ****
*
* @since 9
*/
public Set<SocketOption<?>> supportedOptions() {
synchronized (ServerSocket.class) {
! if (optionsSet) {
return options;
}
try {
SocketImpl impl = getImpl();
options = Collections.unmodifiableSet(impl.supportedOptions());
} catch (IOException e) {
options = Collections.emptySet();
}
optionsSet = true;
return options;
}
}
static {
--- 1004,1031 ----
*
* @since 9
*/
public Set<SocketOption<?>> supportedOptions() {
synchronized (ServerSocket.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;
}
}
static {
< prev index next >