Tue, 17 Sep 2013 08:08:07 -0700
Merge
1.1 --- a/src/share/classes/com/sun/corba/se/impl/transport/DefaultSocketFactoryImpl.java Thu Sep 12 11:08:55 2013 -0700 1.2 +++ b/src/share/classes/com/sun/corba/se/impl/transport/DefaultSocketFactoryImpl.java Tue Sep 17 08:08:07 2013 -0700 1.3 @@ -32,6 +32,7 @@ 1.4 import java.net.ServerSocket; 1.5 import java.nio.channels.SocketChannel; 1.6 import java.nio.channels.ServerSocketChannel; 1.7 +import java.security.PrivilegedAction; 1.8 1.9 import com.sun.corba.se.pept.transport.Acceptor; 1.10 1.11 @@ -44,6 +45,22 @@ 1.12 implements ORBSocketFactory 1.13 { 1.14 private ORB orb; 1.15 + private static final boolean keepAlive; 1.16 + 1.17 + static { 1.18 + keepAlive = java.security.AccessController.doPrivileged( 1.19 + new PrivilegedAction<Boolean>() { 1.20 + @Override 1.21 + public Boolean run () { 1.22 + String value = 1.23 + System.getProperty("com.sun.CORBA.transport.enableTcpKeepAlive"); 1.24 + if (value != null) 1.25 + return new Boolean(!"false".equalsIgnoreCase(value)); 1.26 + 1.27 + return Boolean.FALSE; 1.28 + } 1.29 + }); 1.30 + } 1.31 1.32 public void setORB(ORB orb) 1.33 { 1.34 @@ -85,6 +102,9 @@ 1.35 // Disable Nagle's algorithm (i.e., always send immediately). 1.36 socket.setTcpNoDelay(true); 1.37 1.38 + if (keepAlive) 1.39 + socket.setKeepAlive(true); 1.40 + 1.41 return socket; 1.42 } 1.43 1.44 @@ -95,6 +115,8 @@ 1.45 { 1.46 // Disable Nagle's algorithm (i.e., always send immediately). 1.47 socket.setTcpNoDelay(true); 1.48 + if (keepAlive) 1.49 + socket.setKeepAlive(true); 1.50 } 1.51 } 1.52