corba/src/share/classes/com/sun/corba/se/impl/transport/DefaultSocketFactoryImpl.java
Print this page
*** 30,39 ****
--- 30,40 ----
import java.net.Socket;
import java.net.SocketException;
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;
import com.sun.corba.se.spi.orb.ORB;
import com.sun.corba.se.spi.transport.ORBSocketFactory;
*** 42,52 ****
--- 43,69 ----
public class DefaultSocketFactoryImpl
implements ORBSocketFactory
{
private ORB orb;
+ private static boolean keepAlive = false;
+ static {
+ java.security.AccessController.doPrivileged(
+ new PrivilegedAction<Void>() {
+ @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;
}
*** 83,92 ****
--- 100,112 ----
}
// Disable Nagle's algorithm (i.e., always send immediately).
socket.setTcpNoDelay(true);
+ if (keepAlive)
+ socket.setKeepAlive(true);
+
return socket;
}
public void setAcceptedSocketOptions(Acceptor acceptor,
ServerSocket serverSocket,
*** 93,101 ****
--- 113,123 ----
Socket socket)
throws SocketException
{
// Disable Nagle's algorithm (i.e., always send immediately).
socket.setTcpNoDelay(true);
+ if (keepAlive)
+ socket.setKeepAlive(true);
}
}
// End of file.