mirror of https://github.com/apache/activemq.git
added the ability to configure the TCP keepAlive option
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@434006 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4b6b61b820
commit
d4a834743f
|
@ -64,6 +64,7 @@ public class TcpTransport extends TransportThreadSupport implements Transport, S
|
|||
protected boolean trace;
|
||||
protected boolean useLocalHost = true;
|
||||
protected int minmumWireFormatVersion;
|
||||
private Boolean keepAlive;
|
||||
|
||||
/**
|
||||
* Connect to a remote Node - e.g. a Broker
|
||||
|
@ -206,11 +207,21 @@ public class TcpTransport extends TransportThreadSupport implements Transport, S
|
|||
public void setConnectionTimeout(int connectionTimeout) {
|
||||
this.connectionTimeout = connectionTimeout;
|
||||
}
|
||||
|
||||
|
||||
public Boolean getKeepAlive() {
|
||||
return keepAlive;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable/disable TCP KEEP_ALIVE mode
|
||||
*/
|
||||
public void setKeepAlive(Boolean keepAlive) {
|
||||
this.keepAlive = keepAlive;
|
||||
}
|
||||
|
||||
|
||||
// Implementation methods
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
protected String resolveHostName(String host) throws UnknownHostException {
|
||||
String localName = InetAddress.getLocalHost().getHostName();
|
||||
if (localName != null && isUseLocalHost()) {
|
||||
|
@ -237,6 +248,10 @@ public class TcpTransport extends TransportThreadSupport implements Transport, S
|
|||
log.debug("Cannot set socket buffer size. Reason: " + se, se);
|
||||
}
|
||||
sock.setSoTimeout(soTimeout);
|
||||
|
||||
if (keepAlive != null) {
|
||||
sock.setKeepAlive(keepAlive.booleanValue());
|
||||
}
|
||||
}
|
||||
|
||||
protected void doStart() throws Exception {
|
||||
|
|
Loading…
Reference in New Issue