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:
Hiram R. Chirino 2007-09-05 21:51:40 +00:00
parent 9e61ade946
commit 642d38cd8c
2 changed files with 13 additions and 0 deletions

View File

@ -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);

View File

@ -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);
}
} }