Author: tabish
Date: Tue Aug 10 21:14:58 2010
New Revision: 984211

URL: http://svn.apache.org/viewvc?rev=984211&view=rev
Log:
fix for: https://issues.apache.org/activemq/browse/AMQNET-269

Most of this was already done, recent Command Generator changes fixed all 
Message size problems.  

Modified:
    
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs
    
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConnectionFactory.cs
    
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageProducer.cs
    
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/MemoryUsage.cs

Modified: 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs
URL: 
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs?rev=984211&r1=984210&r2=984211&view=diff
==============================================================================
--- 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs
 (original)
+++ 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs
 Tue Aug 10 21:14:58 2010
@@ -670,9 +670,16 @@ namespace Apache.NMS.ActiveMQ
             else if(command is ProducerAck)
             {
                 ProducerAck ack = (ProducerAck) command;
-                if(ack != null && ack.ProducerId != null) {
-                    MessageProducer producer = (MessageProducer) 
producers[ack.ProducerId];
-                    if( producer != null ) {
+                if(ack != null && ack.ProducerId != null) 
+                               {
+                    MessageProducer producer = producers[ack.ProducerId] as 
MessageProducer;
+                    if(producer != null) 
+                                       {                                       
        
+                                               if(Tracer.IsDebugEnabled)
+                                               {
+                                                       
Tracer.Debug("Connection: Received a new ProducerAck -> " + ack);
+                                               }
+                                               
                         producer.OnProducerAck(ack);
                     }
                 }

Modified: 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConnectionFactory.cs
URL: 
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConnectionFactory.cs?rev=984211&r1=984210&r2=984211&view=diff
==============================================================================
--- 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConnectionFactory.cs
 (original)
+++ 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConnectionFactory.cs
 Tue Aug 10 21:14:58 2010
@@ -45,11 +45,12 @@ namespace Apache.NMS.ActiveMQ
 
         private bool useCompression;
         private bool copyMessageOnSend = true;
-        private bool dispatchAsync=true;
+        private bool dispatchAsync = true;
         private bool asyncSend;
         private bool asyncClose;
         private bool alwaysSyncSend;
-        private bool sendAcksAsync=true;
+        private bool sendAcksAsync = true;
+               private int producerWindowSize = 0;
         private AcknowledgementMode acknowledgementMode = 
AcknowledgementMode.AutoAcknowledge;
                private TimeSpan requestTimeout = 
NMSConstants.defaultRequestTimeout;
 
@@ -272,6 +273,12 @@ namespace Apache.NMS.ActiveMQ
             set { this.acknowledgementMode = value; }
         }
 
+        public int ProducerWindowSize
+        {
+            get { return producerWindowSize; }
+            set { producerWindowSize = value; }
+        }
+               
         public PrefetchPolicy PrefetchPolicy
         {
             get { return this.prefetchPolicy; }
@@ -351,6 +358,7 @@ namespace Apache.NMS.ActiveMQ
             connection.AcknowledgementMode = this.acknowledgementMode;
             connection.UseCompression = this.useCompression;
                        connection.RequestTimeout = this.requestTimeout;
+                       connection.ProducerWindowSize = this.producerWindowSize;
             connection.RedeliveryPolicy = this.redeliveryPolicy.Clone() as 
IRedeliveryPolicy;
             connection.PrefetchPolicy = this.prefetchPolicy.Clone() as 
PrefetchPolicy;
             connection.CompressionPolicy = this.compressionPolicy.Clone() as 
ICompressionPolicy;

Modified: 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageProducer.cs
URL: 
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageProducer.cs?rev=984211&r1=984210&r2=984211&view=diff
==============================================================================
--- 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageProducer.cs
 (original)
+++ 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageProducer.cs
 Tue Aug 10 21:14:58 2010
@@ -64,6 +64,7 @@ namespace Apache.NMS.ActiveMQ
             // have a set producer window size.
             if(session.Connection.ProtocolVersion >= 3 && this.info.WindowSize 
> 0)
             {
+                               Tracer.Debug("MessageProducer created with a 
Window Size of: " + this.info.WindowSize);
                 this.usage = new MemoryUsage(this.info.WindowSize);
             }
         }

Modified: 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/MemoryUsage.cs
URL: 
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/MemoryUsage.cs?rev=984211&r1=984210&r2=984211&view=diff
==============================================================================
--- 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/MemoryUsage.cs
 (original)
+++ 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/MemoryUsage.cs
 Tue Aug 10 21:14:58 2010
@@ -16,6 +16,7 @@
  */
 using System;
 using System.Threading;
+using Apache.NMS;
 using Apache.NMS.Util;
 
 namespace Apache.NMS.ActiveMQ.Util
@@ -79,7 +80,9 @@ namespace Apache.NMS.ActiveMQ.Util
             {
                 while(this.IsFull() && !stopped.Value)
                 {
-                    if( !Monitor.Wait(this.mutex, timeout ) )
+                                       Tracer.Debug("MemoryUsage: Memory Limit 
Reached, waiting for more space.");
+                                       
+                    if(!Monitor.Wait(this.mutex, timeout))
                     {
                         return;
                     }
@@ -116,6 +119,11 @@ namespace Apache.NMS.ActiveMQ.Util
             lock(this.mutex)
             {
                 this.Usage += value;
+                               
+                               if(Tracer.IsDebugEnabled)
+                               {
+                                       Tracer.DebugFormat("MemoryUsage: 
Increase Usage to: {0} bytes.", this.usage);
+                               }                               
             }
         }
 
@@ -142,7 +150,12 @@ namespace Apache.NMS.ActiveMQ.Util
                 {
                     this.Usage -= value;
                 }
-
+                               
+                               if(Tracer.IsDebugEnabled)
+                               {
+                                       Tracer.DebugFormat("MemoryUsage: 
Decrease Usage to: {0} bytes.", this.usage);
+                               }
+                               
                 Monitor.PulseAll(this.mutex);
             }
         }


Reply via email to