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 trace;
|
||||||
protected boolean useLocalHost = true;
|
protected boolean useLocalHost = true;
|
||||||
protected int minmumWireFormatVersion;
|
protected int minmumWireFormatVersion;
|
||||||
|
private Boolean keepAlive;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connect to a remote Node - e.g. a Broker
|
* Connect to a remote Node - e.g. a Broker
|
||||||
|
@ -207,10 +208,20 @@ public class TcpTransport extends TransportThreadSupport implements Transport, S
|
||||||
this.connectionTimeout = 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
|
// Implementation methods
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
protected String resolveHostName(String host) throws UnknownHostException {
|
protected String resolveHostName(String host) throws UnknownHostException {
|
||||||
String localName = InetAddress.getLocalHost().getHostName();
|
String localName = InetAddress.getLocalHost().getHostName();
|
||||||
if (localName != null && isUseLocalHost()) {
|
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);
|
log.debug("Cannot set socket buffer size. Reason: " + se, se);
|
||||||
}
|
}
|
||||||
sock.setSoTimeout(soTimeout);
|
sock.setSoTimeout(soTimeout);
|
||||||
|
|
||||||
|
if (keepAlive != null) {
|
||||||
|
sock.setKeepAlive(keepAlive.booleanValue());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void doStart() throws Exception {
|
protected void doStart() throws Exception {
|
||||||
|
|
Loading…
Reference in New Issue