< prev index next >
src/java.base/share/classes/java/net/Socket.java
Print this page
@@ -1,7 +1,7 @@
/*
- * 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -1789,10 +1789,12 @@
return getImpl().getOption(name);
}
private static Set<SocketOption<?>> options;
private static boolean optionsSet = false;
+ private static Set<SocketOption<?>> rdmaOptions;
+ 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 +1805,32 @@
*
* @since 9
*/
public Set<SocketOption<?>> 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;
}
}
}
< prev index next >