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 2009/10/27 18:43:47 UTC

svn commit: r830261 - in /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp: Connection.cs MessageConsumer.cs

Author: tabish
Date: Tue Oct 27 17:43:46 2009
New Revision: 830261

URL: http://svn.apache.org/viewvc?rev=830261&view=rev
Log:
Fix some issues with Prefecth of zero found during testing.

Modified:
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageConsumer.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=830261&r1=830260&r2=830261&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 Oct 27 17:43:46 2009
@@ -599,10 +599,15 @@
                 {
                     IDispatcher dispatcher = (IDispatcher) dispatchers[dispatch.ConsumerId];
 
-                    dispatch.Message.ReadOnlyBody = true;
-                    dispatch.Message.ReadOnlyProperties = true;
-                    dispatch.Message.RedeliveryCounter = dispatch.RedeliveryCounter;
-
+                    // Can be null when a consumer has sent a MessagePull and there was
+                    // no available message at the broker to dispatch.  
+                    if(dispatch.Message != null)
+                    {
+                        dispatch.Message.ReadOnlyBody = true;
+                        dispatch.Message.ReadOnlyProperties = true;
+                        dispatch.Message.RedeliveryCounter = dispatch.RedeliveryCounter;
+                    }
+                    
                     dispatcher.Dispatch(dispatch);
 
                     return;

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageConsumer.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageConsumer.cs?rev=830261&r1=830260&r2=830261&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageConsumer.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageConsumer.cs Tue Oct 27 17:43:46 2009
@@ -165,8 +165,17 @@
             CheckClosed();
             CheckMessageListener();
     
+            MessageDispatch dispatch = null;
             SendPullRequest((long)timeout.TotalMilliseconds);
-            MessageDispatch dispatch = this.Dequeue(timeout);
+            
+            if(this.PrefetchSize == 0)
+            {
+                dispatch = this.Dequeue(TimeSpan.FromMilliseconds(-1));
+            }
+            else
+            {
+                dispatch = this.Dequeue(timeout);
+            }
             
             if(dispatch == null)
             {
@@ -183,9 +192,18 @@
 		{
             CheckClosed();
             CheckMessageListener();
-    
+
+            MessageDispatch dispatch = null;
             SendPullRequest(-1);
-            MessageDispatch dispatch = this.Dequeue(TimeSpan.Zero);
+            
+            if(this.PrefetchSize == 0)
+            {
+                dispatch = this.Dequeue(TimeSpan.FromMilliseconds(-1));
+            }
+            else
+            {
+                dispatch = this.Dequeue(TimeSpan.Zero);
+            }
             
             if(dispatch == null)
             {
@@ -702,8 +720,6 @@
             } 
             else 
             {
-                Tracer.Debug("AckLater: Old Ack was not the same Ack type.");
-
                 // old pending ack being superseded by ack of another type, if is is not a delivered
                 // ack and hence important, send it now so it is not lost.
                 if(oldPendingAck.AckType != (byte)AckType.DeliveredAck)