< prev index next >

src/jdk.net/linux/classes/jdk/internal/net/rdma/LinuxRdmaSocketImpl.java

Print this page

        

*** 32,54 **** import sun.net.ext.RdmaSocketOptions; import static jdk.internal.net.rdma.RdmaSocketImpl.PlatformRdmaSocketImpl; class LinuxRdmaSocketImpl extends PlatformRdmaSocketImpl { static { java.security.AccessController.doPrivileged( new java.security.PrivilegedAction<>() { public Void run() { System.loadLibrary("net"); System.loadLibrary("extnet"); return null; } }); initProto(); } ! public LinuxRdmaSocketImpl() { } static final RdmaSocketOptions rdmaOptions = RdmaSocketOptions.getInstance(); private static volatile boolean checkedRdma; --- 32,73 ---- import sun.net.ext.RdmaSocketOptions; import static jdk.internal.net.rdma.RdmaSocketImpl.PlatformRdmaSocketImpl; class LinuxRdmaSocketImpl extends PlatformRdmaSocketImpl { + private static final UnsupportedOperationException unsupported; + + private static final Void checkSupported() { + if (unsupported != null) + throw new UnsupportedOperationException(unsupported.getMessage(), unsupported); + else + return null; + } + static { java.security.AccessController.doPrivileged( new java.security.PrivilegedAction<>() { public Void run() { System.loadLibrary("net"); System.loadLibrary("extnet"); return null; } }); + UnsupportedOperationException uoe = null; + try { initProto(); + } catch (UnsupportedOperationException e) { + uoe = e; + } + unsupported = uoe; + } + + public LinuxRdmaSocketImpl() { + this(checkSupported()); } ! private LinuxRdmaSocketImpl(Void unused) { } static final RdmaSocketOptions rdmaOptions = RdmaSocketOptions.getInstance(); private static volatile boolean checkedRdma;
*** 78,88 **** if (socketInputStream != null) { ((RdmaSocketInputStream)socketInputStream).setEOF(true); } } ! static native void initProto(); private static native boolean isRdmaAvailable0(); native void rdmaSocketCreate(RdmaSocketImpl impl) throws IOException; --- 97,107 ---- if (socketInputStream != null) { ((RdmaSocketInputStream)socketInputStream).setEOF(true); } } ! static native void initProto() throws UnsupportedOperationException; private static native boolean isRdmaAvailable0(); native void rdmaSocketCreate(RdmaSocketImpl impl) throws IOException;
< prev index next >