7115586: Suppress creation of SocketImpl in SocketAdaptor's constructor
authorchegar
Fri, 25 Nov 2011 13:46:28 +0000
changeset 11106 802bb70d8fa2
parent 11105 4dcb5baa61f3
child 11107 fc8efc57da08
7115586: Suppress creation of SocketImpl in SocketAdaptor's constructor Reviewed-by: chegar, alanb Contributed-by: sajia@taobao.com
jdk/src/share/classes/sun/nio/ch/SocketAdaptor.java
--- a/jdk/src/share/classes/sun/nio/ch/SocketAdaptor.java	Fri Nov 25 10:34:05 2011 +0000
+++ b/jdk/src/share/classes/sun/nio/ch/SocketAdaptor.java	Fri Nov 25 13:46:28 2011 +0000
@@ -57,13 +57,17 @@
     // Timeout "option" value for reads
     private volatile int timeout = 0;
 
-    // ## super will create a useless impl
-    private SocketAdaptor(SocketChannelImpl sc) {
+    private SocketAdaptor(SocketChannelImpl sc) throws SocketException {
+        super((SocketImpl) null);
         this.sc = sc;
     }
 
     public static Socket create(SocketChannelImpl sc) {
-        return new SocketAdaptor(sc);
+        try {
+            return new SocketAdaptor(sc);
+        } catch (SocketException e) {
+            throw new InternalError("Should not reach here");
+        }
     }
 
     public SocketChannel getChannel() {