Cleanup/comments niosocketimpl-branch
authoralanb
Tue, 26 Feb 2019 11:14:51 +0000
branchniosocketimpl-branch
changeset 57212 28b0946d3b81
parent 57211 4503441bec2e
child 57222 86e1d9d76ef4
Cleanup/comments
src/java.base/share/classes/java/net/HttpConnectSocketImpl.java
src/java.base/share/classes/java/net/Socket.java
src/java.base/share/classes/java/net/SocketImpl.java
src/java.base/share/classes/java/net/SocksSocketImpl.java
src/java.base/share/classes/sun/nio/ch/NioSocketImpl.java
--- a/src/java.base/share/classes/java/net/HttpConnectSocketImpl.java	Tue Feb 26 08:53:16 2019 +0000
+++ b/src/java.base/share/classes/java/net/HttpConnectSocketImpl.java	Tue Feb 26 11:14:51 2019 +0000
@@ -25,23 +25,17 @@
 
 package java.net;
 
-import java.io.FileDescriptor;
 import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
 
-import sun.nio.ch.NioSocketImpl;
-
 /**
  * Basic SocketImpl that relies on the internal HTTP protocol handler
- * implementation to perform the HTTP tunneling and authentication. The
- * sockets impl is swapped out and replaced with the socket from the HTTP
- * handler after the tunnel is successfully setup.
+ * implementation to perform the HTTP tunneling and authentication. Once
+ * connected, all socket operations delegate to a platform SocketImpl.
  *
  * @since 1.8
  */
@@ -80,11 +74,6 @@
             throw new InternalError("Should not reach here", x);
         }
     }
-    HttpConnectSocketImpl(SocketImpl delegate) {
-        super(delegate);
-        this.server = null;
-        throw new InternalError();
-    }
 
     HttpConnectSocketImpl(Proxy proxy, SocketImpl delegate) {
         super(delegate);
@@ -168,8 +157,8 @@
     }
 
     @Override
-    void reset() throws IOException {
-        delegate.reset();
+    void reset() {
+        throw new InternalError("should not get here");
     }
 
     @Override
--- a/src/java.base/share/classes/java/net/Socket.java	Tue Feb 26 08:53:16 2019 +0000
+++ b/src/java.base/share/classes/java/net/Socket.java	Tue Feb 26 11:14:51 2019 +0000
@@ -949,6 +949,13 @@
         return in;
     }
 
+    /**
+     * An InputStream that delegates read/available operations to an underlying
+     * input stream. The close method is overridden to close the Socket.
+     *
+     * This class is instrumented by Java Flight Recorder (JFR) to get socket
+     * I/O events.
+     */
     private static class SocketInputStream extends InputStream {
         private final Socket parent;
         private final InputStream in;
@@ -1012,6 +1019,13 @@
         return out;
     }
 
+    /**
+     * An OutputStream that delegates write operations to an underlying output
+     * stream. The close method is overridden to close the Socket.
+     *
+     * This class is instrumented by Java Flight Recorder (JFR) to get socket
+     * I/O events.
+     */
     private static class SocketOutputStream extends OutputStream {
         private final Socket parent;
         private final OutputStream out;
--- a/src/java.base/share/classes/java/net/SocketImpl.java	Tue Feb 26 08:53:16 2019 +0000
+++ b/src/java.base/share/classes/java/net/SocketImpl.java	Tue Feb 26 11:14:51 2019 +0000
@@ -58,7 +58,7 @@
     }
 
     /**
-     * Creates a instance of platform's SocketImpl
+     * Creates an instance of platform's SocketImpl
      */
     @SuppressWarnings("unchecked")
     static <S extends SocketImpl & PlatformSocketImpl> S createPlatformSocketImpl(boolean server) {
--- a/src/java.base/share/classes/java/net/SocksSocketImpl.java	Tue Feb 26 08:53:16 2019 +0000
+++ b/src/java.base/share/classes/java/net/SocksSocketImpl.java	Tue Feb 26 11:14:51 2019 +0000
@@ -24,24 +24,19 @@
  */
 package java.net;
 
-import java.io.FileDescriptor;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.BufferedOutputStream;
 import java.security.AccessController;
-import java.util.Objects;
-import java.util.Set;
 
 import jdk.internal.util.StaticProperty;
 import sun.net.SocksProxy;
 import sun.net.spi.DefaultProxySelector;
 import sun.net.www.ParseUtil;
-import sun.nio.ch.NioSocketImpl;
 
 /**
  * SOCKS (V4 & V5) TCP socket implementation (RFC 1928).
- * Note this class should <b>NOT</b> be public.
  */
 
 class SocksSocketImpl extends DelegatingSocketImpl implements SocksConsts {
@@ -593,7 +588,7 @@
     }
 
     @Override
-    void reset() throws IOException {
-        delegate.reset();
+    void reset() {
+        throw new InternalError("should not get here");
     }
 }
--- a/src/java.base/share/classes/sun/nio/ch/NioSocketImpl.java	Tue Feb 26 08:53:16 2019 +0000
+++ b/src/java.base/share/classes/sun/nio/ch/NioSocketImpl.java	Tue Feb 26 11:14:51 2019 +0000
@@ -133,7 +133,7 @@
     private boolean connectionReset;
 
     /**
-     * Creates a instance of this SocketImpl.
+     * Creates an instance of this SocketImpl.
      * @param server true if this is a SocketImpl for a ServerSocket
      */
     public NioSocketImpl(boolean server) {