--- old/corba/src/share/classes/com/sun/corba/se/impl/transport/DefaultSocketFactoryImpl.java Tue Sep 3 11:47:11 2013 +++ new/corba/src/share/classes/com/sun/corba/se/impl/transport/DefaultSocketFactoryImpl.java Tue Sep 3 11:47:11 2013 @@ -32,6 +32,7 @@ import java.net.ServerSocket; import java.nio.channels.SocketChannel; import java.nio.channels.ServerSocketChannel; +import java.security.PrivilegedAction; import com.sun.corba.se.pept.transport.Acceptor; @@ -44,7 +45,23 @@ implements ORBSocketFactory { private ORB orb; + private static boolean keepAlive = false; + static { + java.security.AccessController.doPrivileged( + new PrivilegedAction() { + @Override + public Void run () { + String value = + System.getProperty("com.sun.CORBA.transport.enableTcpKeepAlive"); + if (value != null) + keepAlive = !"false".equalsIgnoreCase(value); + + return null; + } + }); + } + public void setORB(ORB orb) { this.orb = orb; @@ -85,6 +102,9 @@ // Disable Nagle's algorithm (i.e., always send immediately). socket.setTcpNoDelay(true); + if (keepAlive) + socket.setKeepAlive(true); + return socket; } @@ -95,6 +115,8 @@ { // Disable Nagle's algorithm (i.e., always send immediately). socket.setTcpNoDelay(true); + if (keepAlive) + socket.setKeepAlive(true); } }