224 platformRdmaSocketOptions.setSockOpt(fdAccess.get(fd), opt, val);
225 }
226
227 private static int getSockOpt(FileDescriptor fd, int opt)
228 throws SocketException
229 {
230 return platformRdmaSocketOptions.getSockOpt(fdAccess.get(fd), opt);
231 }
232
233 static class PlatformRdmaSocketOptions {
234
235 protected PlatformRdmaSocketOptions() {}
236
237 @SuppressWarnings("unchecked")
238 private static PlatformRdmaSocketOptions newInstance(String cn) {
239 Class<PlatformRdmaSocketOptions> c;
240 try {
241 c = (Class<PlatformRdmaSocketOptions>)Class.forName(cn);
242 return c.getConstructor(new Class<?>[] { }).newInstance();
243 } catch (ReflectiveOperationException x) {
244 throw new AssertionError(x);
245 }
246 }
247
248 private static PlatformRdmaSocketOptions create() {
249 String osname = AccessController.doPrivileged(
250 new PrivilegedAction<String>() {
251 public String run() {
252 return System.getProperty("os.name");
253 }
254 });
255 if ("Linux".equals(osname))
256 return newInstance("jdk.net.LinuxRdmaSocketOptions");
257 return new PlatformRdmaSocketOptions();
258 }
259
260 private static final PlatformRdmaSocketOptions instance = create();
261
262 static PlatformRdmaSocketOptions get() {
263 return instance;
264 }
265
266 void setSockOpt(int fd, int opt, int value)
267 throws SocketException
268 {
269 throw new UnsupportedOperationException("unsupported socket option");
270 }
271
272 int getSockOpt(int fd, int opt) throws SocketException {
273 throw new UnsupportedOperationException("unsupported socket option");
274 }
275
276 boolean rdmaSocketSupported() {
|
224 platformRdmaSocketOptions.setSockOpt(fdAccess.get(fd), opt, val);
225 }
226
227 private static int getSockOpt(FileDescriptor fd, int opt)
228 throws SocketException
229 {
230 return platformRdmaSocketOptions.getSockOpt(fdAccess.get(fd), opt);
231 }
232
233 static class PlatformRdmaSocketOptions {
234
235 protected PlatformRdmaSocketOptions() {}
236
237 @SuppressWarnings("unchecked")
238 private static PlatformRdmaSocketOptions newInstance(String cn) {
239 Class<PlatformRdmaSocketOptions> c;
240 try {
241 c = (Class<PlatformRdmaSocketOptions>)Class.forName(cn);
242 return c.getConstructor(new Class<?>[] { }).newInstance();
243 } catch (ReflectiveOperationException x) {
244 if (x.getCause() instanceof UnsupportedOperationException)
245 throw (UnsupportedOperationException)x.getCause();
246 throw new AssertionError(x);
247 }
248 }
249
250 private static PlatformRdmaSocketOptions create() {
251 String osname = AccessController.doPrivileged(
252 new PrivilegedAction<String>() {
253 public String run() {
254 return System.getProperty("os.name");
255 }
256 });
257 if ("Linux".equals(osname)) {
258 try {
259 return newInstance("jdk.net.LinuxRdmaSocketOptions");
260 } catch (UnsupportedOperationException uoe) {
261 return new PlatformRdmaSocketOptions();
262 }
263 }
264 return new PlatformRdmaSocketOptions();
265 }
266
267 private static final PlatformRdmaSocketOptions instance = create();
268
269 static PlatformRdmaSocketOptions get() {
270 return instance;
271 }
272
273 void setSockOpt(int fd, int opt, int value)
274 throws SocketException
275 {
276 throw new UnsupportedOperationException("unsupported socket option");
277 }
278
279 int getSockOpt(int fd, int opt) throws SocketException {
280 throw new UnsupportedOperationException("unsupported socket option");
281 }
282
283 boolean rdmaSocketSupported() {
|