changeset 4560:0bb7ab40ab76

7115586: (so) Suppress creation of SocketImpl in SocketAdaptor's constructor Reviewed-by: chegar
author mbankal
date Fri, 30 Dec 2011 04:51:12 -0800
parents e5b699ef3c77
children f56205750512
files src/share/classes/sun/nio/ch/SocketAdaptor.java
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/nio/ch/SocketAdaptor.java	Wed Jan 04 17:44:34 2012 -0800
+++ b/src/share/classes/sun/nio/ch/SocketAdaptor.java	Fri Dec 30 04:51:12 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -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() {