changeset 4794:e5ecbf555679

7115586: Suppress creation of SocketImpl in SocketAdaptor's constructor Reviewed-by: chegar, alanb Contributed-by: sajia@taobao.com
author chegar
date Fri, 25 Nov 2011 13:46:28 +0000
parents 387190e1f782
children 022540b11147
files src/share/classes/sun/nio/ch/SocketAdaptor.java
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/nio/ch/SocketAdaptor.java	Fri Nov 25 10:34:05 2011 +0000
+++ b/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() {