src/java.base/unix/classes/java/net/PlainSocketImpl.java
changeset 54689 b28b7f631301
parent 53419 eac105e3ec13
child 55081 dd321e3596c0
--- a/src/java.base/unix/classes/java/net/PlainSocketImpl.java	Mon Apr 29 17:54:15 2019 -0700
+++ b/src/java.base/unix/classes/java/net/PlainSocketImpl.java	Thu May 02 17:29:10 2019 +0100
@@ -45,13 +45,8 @@
     /**
      * Constructs an empty instance.
      */
-    PlainSocketImpl() { }
-
-    /**
-     * Constructs an instance with the given file descriptor.
-     */
-    PlainSocketImpl(FileDescriptor fd) {
-        this.fd = fd;
+    PlainSocketImpl(boolean isServer) {
+        super(isServer);
     }
 
     static final ExtendedSocketOptions extendedOptions =
@@ -90,7 +85,7 @@
 
     protected Set<SocketOption<?>> supportedOptions() {
         HashSet<SocketOption<?>> options = new HashSet<>(super.supportedOptions());
-        if (getServerSocket() != null) {
+        if (isServer) {
             options.addAll(ExtendedSocketOptions.serverSocketOptions());
         } else {
             options.addAll(ExtendedSocketOptions.clientSocketOptions());
@@ -106,12 +101,16 @@
         try {
             socketSetOption0(opt, b, val);
         } catch (SocketException se) {
-            if (socket == null || !socket.isConnected())
+            if (!isConnected)
                 throw se;
         }
     }
 
-    native void socketCreate(boolean isServer) throws IOException;
+    void socketCreate(boolean stream) throws IOException {
+        socketCreate(stream, isServer);
+    }
+
+    native void socketCreate(boolean stream, boolean isServer) throws IOException;
 
     native void socketConnect(InetAddress address, int port, int timeout)
         throws IOException;