13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package jdk.net; 27 28 import java.net.SocketException; 29 import jdk.net.RdmaSocketOptions.PlatformRdmaSocketOptions; 30 31 class LinuxRdmaSocketOptions extends PlatformRdmaSocketOptions { 32 33 public LinuxRdmaSocketOptions() { } 34 35 @Override native void setSockOpt(int fd, int opt, int value) 36 throws SocketException; 37 38 @Override native int getSockOpt(int fd, int opt) 39 throws SocketException; 40 41 @Override native boolean rdmaSocketSupported(); 42 43 static { 44 java.security.AccessController.doPrivileged( 45 new java.security.PrivilegedAction<>() { 46 public Void run() { 47 System.loadLibrary("extnet"); 48 return null; 49 } 50 }); 51 init(); 52 } 53 private static native void init(); 54 } | 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package jdk.net; 27 28 import java.net.SocketException; 29 import jdk.net.RdmaSocketOptions.PlatformRdmaSocketOptions; 30 31 class LinuxRdmaSocketOptions extends PlatformRdmaSocketOptions { 32 33 private static final UnsupportedOperationException unsupported; 34 35 private static final Void checkSupported() { 36 if (unsupported != null) 37 throw new UnsupportedOperationException(unsupported.getMessage(), unsupported); 38 else 39 return null; 40 } 41 42 public LinuxRdmaSocketOptions() { 43 this(checkSupported()); 44 } 45 46 private LinuxRdmaSocketOptions(Void unused) { } 47 48 @Override native void setSockOpt(int fd, int opt, int value) 49 throws SocketException; 50 51 @Override native int getSockOpt(int fd, int opt) 52 throws SocketException; 53 54 @Override native boolean rdmaSocketSupported(); 55 56 static { 57 java.security.AccessController.doPrivileged( 58 new java.security.PrivilegedAction<>() { 59 public Void run() { 60 System.loadLibrary("extnet"); 61 return null; 62 } 63 }); 64 UnsupportedOperationException uoe = null; 65 try { 66 init(); 67 } catch (UnsupportedOperationException e) { 68 uoe = e; 69 } 70 unsupported = uoe; 71 } 72 73 private static native void init() throws UnsupportedOperationException; 74 } |