mirror of https://github.com/apache/activemq.git
We now actually update the tcpNoDelay setting on the socket once the wireformat options are negociated. This allows the client to control if his socket and the server's socket use the option. By default tcpNoDelay is enabled. the client should use a URL like -Durl=tcp://localhost:61616?wireFormat.tcpNoDelayEnabled=false to disable tcpNoDelay on both the client and the server socket. git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@573080 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9e61ade946
commit
642d38cd8c
|
@ -18,6 +18,7 @@ package org.apache.activemq.transport;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InterruptedIOException;
|
import java.io.InterruptedIOException;
|
||||||
|
import java.net.Socket;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
@ -111,6 +112,10 @@ public class WireFormatNegotiator extends TransportFilter {
|
||||||
}
|
}
|
||||||
|
|
||||||
wireFormat.renegotiateWireFormat(info);
|
wireFormat.renegotiateWireFormat(info);
|
||||||
|
Socket socket = next.narrow(Socket.class);
|
||||||
|
if (socket != null) {
|
||||||
|
socket.setTcpNoDelay(wireFormat.isTcpNoDelayEnabled());
|
||||||
|
}
|
||||||
|
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
LOG.debug(this + " after negotiation: " + wireFormat);
|
LOG.debug(this + " after negotiation: " + wireFormat);
|
||||||
|
|
|
@ -483,5 +483,13 @@ public class TcpTransport extends TransportThreadSupport implements Transport, S
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T> T narrow(Class<T> target) {
|
||||||
|
if (target == Socket.class) {
|
||||||
|
return target.cast(socket);
|
||||||
|
}
|
||||||
|
return super.narrow(target);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue