mirror of https://github.com/apache/activemq.git
https://issues.apache.org/jira/browse/AMQ-3315 - Allow socket option soLinger to be enabled on TcpTransport. allow disable, soLinger == -1, disable, > -1 enable otherwise not set so system default
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1102232 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e8d45cb2d0
commit
52d5189698
|
@ -129,7 +129,7 @@ public class TcpTransport extends TransportThreadSupport implements Transport, S
|
||||||
protected final AtomicReference<CountDownLatch> stoppedLatch = new AtomicReference<CountDownLatch>();
|
protected final AtomicReference<CountDownLatch> stoppedLatch = new AtomicReference<CountDownLatch>();
|
||||||
|
|
||||||
private Map<String, Object> socketOptions;
|
private Map<String, Object> socketOptions;
|
||||||
private int soLinger = -1;
|
private int soLinger = Integer.MIN_VALUE;
|
||||||
private Boolean keepAlive;
|
private Boolean keepAlive;
|
||||||
private Boolean tcpNoDelay;
|
private Boolean tcpNoDelay;
|
||||||
private Thread runnerThread;
|
private Thread runnerThread;
|
||||||
|
@ -360,8 +360,8 @@ public class TcpTransport extends TransportThreadSupport implements Transport, S
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable soLinger with the specified soLinger
|
* Enable/disable soLinger
|
||||||
* @param soLinger enabled if > -1
|
* @param soLinger enabled if > -1, disabled if == -1, system default otherwise
|
||||||
*/
|
*/
|
||||||
public void setSoLinger(int soLinger) {
|
public void setSoLinger(int soLinger) {
|
||||||
this.soLinger = soLinger;
|
this.soLinger = soLinger;
|
||||||
|
@ -448,8 +448,10 @@ public class TcpTransport extends TransportThreadSupport implements Transport, S
|
||||||
sock.setKeepAlive(keepAlive.booleanValue());
|
sock.setKeepAlive(keepAlive.booleanValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (soLinger != -1) {
|
if (soLinger > -1) {
|
||||||
sock.setSoLinger(true, soLinger);
|
sock.setSoLinger(true, soLinger);
|
||||||
|
} else if (soLinger == -1) {
|
||||||
|
sock.setSoLinger(false, 0);
|
||||||
}
|
}
|
||||||
if (tcpNoDelay != null) {
|
if (tcpNoDelay != null) {
|
||||||
sock.setTcpNoDelay(tcpNoDelay.booleanValue());
|
sock.setTcpNoDelay(tcpNoDelay.booleanValue());
|
||||||
|
|
|
@ -139,6 +139,8 @@ public class TransportUriTest extends EmbeddedBrokerTestSupport {
|
||||||
// TODO: Add more combinations.
|
// TODO: Add more combinations.
|
||||||
addCombinationValues("postfix", new Object[]
|
addCombinationValues("postfix", new Object[]
|
||||||
{"?tcpNoDelay=true&keepAlive=true&soLinger=0"});
|
{"?tcpNoDelay=true&keepAlive=true&soLinger=0"});
|
||||||
|
addCombinationValues("postfix", new Object[]
|
||||||
|
{"?tcpNoDelay=true&keepAlive=true&soLinger=-1"});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testValidOptionsWork(String options, String msg) {
|
private void testValidOptionsWork(String options, String msg) {
|
||||||
|
|
Loading…
Reference in New Issue