author | bpb |
Wed, 06 Feb 2019 12:48:01 -0800 | |
branch | rsocket-branch |
changeset 57156 | 81e4a12fd1a4 |
parent 57115 | 512e7cc6ccce |
child 57160 | c502c299d41e |
permissions | -rw-r--r-- |
57115 | 1 |
/* |
57156
81e4a12fd1a4
rsocket-branch: change recent copyright year to 2019 and new files to 2019 only
bpb
parents:
57115
diff
changeset
|
2 |
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. |
57115 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. Oracle designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
|
10 |
* |
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
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 |
} |