activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r573080 - in /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport: WireFormatNegotiator.java tcp/TcpTransport.java
Date Wed, 05 Sep 2007 21:51:41 GMT
Author: chirino
Date: Wed Sep  5 14:51:40 2007
New Revision: 573080

URL: http://svn.apache.org/viewvc?rev=573080&view=rev
Log:
Fix for https://issues.apache.org/activemq/browse/AMQ-1156
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.


Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/WireFormatNegotiator.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/WireFormatNegotiator.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/WireFormatNegotiator.java?rev=573080&r1=573079&r2=573080&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/WireFormatNegotiator.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/WireFormatNegotiator.java
Wed Sep  5 14:51:40 2007
@@ -18,6 +18,7 @@
 
 import java.io.IOException;
 import java.io.InterruptedIOException;
+import java.net.Socket;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
@@ -111,6 +112,10 @@
                 }
 
                 wireFormat.renegotiateWireFormat(info);
+                Socket socket = next.narrow(Socket.class);
+                if (socket != null) {
+                    socket.setTcpNoDelay(wireFormat.isTcpNoDelayEnabled());
+                }
 
                 if (LOG.isDebugEnabled()) {
                     LOG.debug(this + " after negotiation: " + wireFormat);

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java?rev=573080&r1=573079&r2=573080&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java
Wed Sep  5 14:51:40 2007
@@ -483,5 +483,13 @@
         }
         return null;
     }
+    
+    @Override
+    public <T> T narrow(Class<T> target) {
+        if (target == Socket.class) {
+            return target.cast(socket);
+        }
+        return super.narrow(target);
+    }
 
 }



Mime
View raw message