Fwd: Re: Suppress creation of SocksSocketImpl in SocketAdaptor's constructor
=?gb2312?B?yPblyA==?=
sajia at taobao.com
Fri Nov 25 03:43:25 PST 2011
Looks good to me. Thank you Chris :-)
- Kris
(This is Krystal Mok's work email)
From: nio-dev-bounces at openjdk.java.net [mailto:nio-dev-bounces at openjdk.java.net] on behalf of Chris Hegarty
Date: Nov 25, 2011 19:39
To: Krystal Mok
CC: nio-dev
Title: Re: Fwd: Re: Suppress creation of SocksSocketImpl in SocketAdaptor's constructor
For clarity, the changes I intend to push for this are as follows:
diff -r 2db942c7eb9c src/share/classes/sun/nio/ch/SocketAdaptor.java
--- a/src/share/classes/sun/nio/ch/SocketAdaptor.java Mon Nov 21
12:57:36 2011 +0000
+++ b/src/share/classes/sun/nio/ch/SocketAdaptor.java Fri Nov 25
11:33:47 2011 +0000
@@ -57,13 +57,17 @@ public class SocketAdaptor
// 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() {
Thanks,
-Chris.
On 21/11/2011 10:11, Krystal Mok wrote:
> Thank you very much. I agree InternalError is better, too, even though
> it shouldn't be reached anyway.
>
> - Kris
>
> 2011/11/21 Chris Hegarty <chris.hegarty at oracle.com
> <mailto:chris.hegarty at oracle.com>>
>
> On 19/11/2011 19:44, Alan Bateman wrote:
> > On 18/11/2011 10:57, Chris Hegarty wrote:
> >> Hi Kris,
> >>
> >> I think this change should be fine, but I would like Alan to
> comment also.
> >>
> > I looked at it in more detail and I think it should okay. Will you
> > sponsor it? My only comment on the change is the catching of
> > SocketException causes a RuntimeException to be thrown but that is
> > inconsistent with other areas of this code where AssertionError or
> > InternalError is thrown.
>
> Yes, I can sponsor this change. And yes, I agree InternalError would be
> better.
>
> -Chris.
>
> >
> > -Alan
>
>
This email (including any attachments) is confidential and may be legally privileged. If you received this email in error, please delete it immediately and do not copy it or use it for any purpose or disclose its contents to any other person. Thank you.
±¾µçÓÊ(°üÀ¨Èκθ½¼þ)¿ÉÄܺ¬ÓлúÃÜ×ÊÁϲ¢ÊÜ·¨Âɱ£»¤¡£ÈçÄú²»ÊÇÕýÈ·µÄÊÕ¼þÈË£¬ÇëÄúÁ¢¼´É¾³ý±¾Óʼþ¡£Çë²»Òª½«±¾µçÓʽøÐи´ÖƲ¢ÓÃ×÷ÈκÎÆäËûÓÃ;¡¢»ò͸¶±¾ÓʼþÖ®ÄÚÈÝ¡£Ð»Ð»¡£
More information about the nio-dev
mailing list