提交 bb7e900c 编写于 作者: L lana

Merge

......@@ -32,6 +32,7 @@ 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;
......@@ -44,6 +45,22 @@ public class DefaultSocketFactoryImpl
implements ORBSocketFactory
{
private ORB orb;
private static final boolean keepAlive;
static {
keepAlive = java.security.AccessController.doPrivileged(
new PrivilegedAction<Boolean>() {
@Override
public Boolean run () {
String value =
System.getProperty("com.sun.CORBA.transport.enableTcpKeepAlive");
if (value != null)
return new Boolean(!"false".equalsIgnoreCase(value));
return Boolean.FALSE;
}
});
}
public void setORB(ORB orb)
{
......@@ -85,6 +102,9 @@ public class DefaultSocketFactoryImpl
// Disable Nagle's algorithm (i.e., always send immediately).
socket.setTcpNoDelay(true);
if (keepAlive)
socket.setKeepAlive(true);
return socket;
}
......@@ -95,6 +115,8 @@ public class DefaultSocketFactoryImpl
{
// Disable Nagle's algorithm (i.e., always send immediately).
socket.setTcpNoDelay(true);
if (keepAlive)
socket.setKeepAlive(true);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册