RFR 8022661: InetAddress.writeObject() performs flush() on object output stream

Alan Bateman Alan.Bateman at oracle.com
Fri Aug 9 03:59:34 PDT 2013


On 09/08/2013 02:23, Chris Hegarty wrote:
> This is a trivial change to remove the unnecessary flush from 
> InetAddress.writeObject(). The flush can have a negative affect if the 
> ObjectOutputStream is wrapping an underlying Socket stream.
>
> diff -r 662115496d6b src/share/classes/java/net/InetAddress.java
> --- a/src/share/classes/java/net/InetAddress.java       Thu Aug 08 
> 17:28:00 2013 +0400
> +++ b/src/share/classes/java/net/InetAddress.java       Fri Aug 09 
> 10:17:11 2013 +0100
> @@ -1601,7 +1601,6 @@ class InetAddress implements java.io.Ser
>          pf.put("address", holder().getAddress());
>          pf.put("family", holder().getFamily());
>          s.writeFields();
> -        s.flush();
>      }
>  }
This looks okay to me, looks like the flush is completely unnecessary.

-Alan



More information about the net-dev mailing list