< prev index next >

src/java.base/share/classes/java/net/ServerSocket.java

Print this page

        

*** 74,87 **** * Are we using an older SocketImpl? */ private boolean oldImpl = false; /** ! * Package-private constructor to create a ServerSocket associated with ! * the given SocketImpl. */ ! ServerSocket(SocketImpl impl) { this.impl = impl; impl.setServerSocket(this); } /** --- 74,88 ---- * Are we using an older SocketImpl? */ private boolean oldImpl = false; /** ! * Creates a server socket with a user-specified SocketImpl. ! * ! * @param impl the user-specified SocketImpl */ ! protected ServerSocket(SocketImpl impl) { this.impl = impl; impl.setServerSocket(this); } /**
*** 513,523 **** public Socket accept() throws IOException { if (isClosed()) throw new SocketException("Socket is closed"); if (!isBound()) throw new SocketException("Socket is not bound yet"); ! Socket s = new Socket((SocketImpl) null); implAccept(s); return s; } /** --- 514,537 ---- public Socket accept() throws IOException { if (isClosed()) throw new SocketException("Socket is closed"); if (!isBound()) throw new SocketException("Socket is not bound yet"); ! ! Socket s = null; ! Class<?> cls = impl.getClass(); ! if (cls.getName().contains("RdmaSocketImpl")) { ! try { ! Constructor<?> c = cls.getConstructor(); ! s = new Socket((SocketImpl)c.newInstance()); ! } catch (NoSuchMethodException | InstantiationException | ! IllegalAccessException | InvocationTargetException e) { ! throw new AssertionError(e); ! } ! } else { ! s = new Socket((SocketImpl) null); ! } implAccept(s); return s; } /**
*** 544,555 **** else { s.impl.reset(); } si = s.impl; s.impl = null; ! si.address = new InetAddress(); ! si.fd = new FileDescriptor(); getImpl().accept(si); SocketCleanable.register(si.fd); // raw fd has been set SecurityManager security = System.getSecurityManager(); if (security != null) { --- 558,569 ---- else { s.impl.reset(); } si = s.impl; s.impl = null; ! si.setAddress(new InetAddress()); ! si.setFileDescriptor(new FileDescriptor()); getImpl().accept(si); SocketCleanable.register(si.fd); // raw fd has been set SecurityManager security = System.getSecurityManager(); if (security != null) {
< prev index next >