You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2012/08/10 00:20:33 UTC

svn commit: r1371514 - in /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp: TcpTransport.cs TcpTransportFactory.cs

Author: tabish
Date: Thu Aug  9 22:20:32 2012
New Revision: 1371514

URL: http://svn.apache.org/viewvc?rev=1371514&view=rev
Log:
https://issues.apache.org/jira/browse/AMQNET-391

Enhance TcpTransport to use the send and receive buffer size to configure the size of the buffered streams that wrap the network streams. 

Modified:
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/TcpTransport.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/TcpTransportFactory.cs

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/TcpTransport.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/TcpTransport.cs?rev=1371514&r1=1371513&r2=1371514&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/TcpTransport.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/TcpTransport.cs Thu Aug  9 22:20:32 2012
@@ -49,6 +49,26 @@ namespace Apache.NMS.ActiveMQ.Transport.
 		private ResumedHandler resumedHandler;
 		private TimeSpan MAX_THREAD_WAIT = TimeSpan.FromMilliseconds(30000);
 
+        /// <summary>
+        /// Size in bytes of the receive buffer.
+        /// </summary>
+        private int receiveBufferSize = 8192;
+        public int ReceiveBufferSize
+        {
+            get { return receiveBufferSize; }
+            set { receiveBufferSize = value; }
+        }
+
+        /// <summary>
+        /// Size in bytes of send buffer.
+        /// </summary>
+        private int sendBufferSize = 8192;
+        public int SendBufferSize
+        {
+            get { return sendBufferSize; }
+            set { sendBufferSize = value; }
+        }
+
 		public TcpTransport(Uri uri, Socket socket, IWireFormat wireformat)
 		{
 			this.connectedUri = uri;

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/TcpTransportFactory.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/TcpTransportFactory.cs?rev=1371514&r1=1371513&r2=1371514&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/TcpTransportFactory.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/TcpTransportFactory.cs Thu Aug  9 22:20:32 2012
@@ -184,7 +184,14 @@ namespace Apache.NMS.ActiveMQ.Transport.
 		/// </summary>
 		protected virtual ITransport DoCreateTransport(Uri location, Socket socket, IWireFormat wireFormat )
 		{
-			return new TcpTransport(location, socket, wireFormat);
+			TcpTransport transport = new TcpTransport(location, socket, wireFormat);
+
+			// Apply the buffer sizes to the transport also so that it can buffer above the
+			// TCP level which can eagerly send causing sparse packets.
+			transport.SendBufferSize = SendBufferSize;
+			transport.ReceiveBufferSize = ReceiveBufferSize;
+
+			return transport;
 		}
 		
         // DISCUSSION: Caching host entries may not be the best strategy when using the