# HG changeset patch # User robm # Date 1495643145 -3600 # Node ID fd3fdfe96bb494608201a35496b598a725076de0 # Parent 9c9e51c44638a182ff4dabdc7a5663f36cef322c 8175131: sun.rmi.transport.tcp.TCPChannel.createConnection close connection on timeout Reviewed-by: rriggs, msheppar diff -r 9c9e51c44638 -r fd3fdfe96bb4 jdk/src/java.rmi/share/classes/sun/rmi/transport/tcp/TCPChannel.java --- a/jdk/src/java.rmi/share/classes/sun/rmi/transport/tcp/TCPChannel.java Tue May 23 14:34:45 2017 -0700 +++ b/jdk/src/java.rmi/share/classes/sun/rmi/transport/tcp/TCPChannel.java Wed May 24 17:25:45 2017 +0100 @@ -296,11 +296,19 @@ out.flush(); } } catch (IOException e) { - if (e instanceof RemoteException) + if (e instanceof RemoteException) { throw (RemoteException) e; - else + } else { + if (conn != null + && e instanceof java.net.SocketTimeoutException) + { + try { + conn.close(); + } catch (Exception ex) {} + } throw new ConnectIOException( "error during JRMP connection establishment", e); + } } } else { try {