Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 88902 invoked from network); 10 Aug 2010 21:16:20 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 10 Aug 2010 21:16:20 -0000 Received: (qmail 66273 invoked by uid 500); 10 Aug 2010 21:16:20 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 66198 invoked by uid 500); 10 Aug 2010 21:16:19 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 66191 invoked by uid 99); 10 Aug 2010 21:16:19 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Aug 2010 21:16:19 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Aug 2010 21:16:16 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 9A155238890B; Tue, 10 Aug 2010 21:14:58 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r984211 - in /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp: Connection.cs ConnectionFactory.cs MessageProducer.cs Util/MemoryUsage.cs Date: Tue, 10 Aug 2010 21:14:58 -0000 To: commits@activemq.apache.org From: tabish@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100810211458.9A155238890B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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); } }