activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1082145 - in /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src: main/csharp/QueueBrowser.cs test/csharp/QueueBrowserTests.cs
Date Wed, 16 Mar 2011 13:39:44 GMT
Author: tabish
Date: Wed Mar 16 13:39:44 2011
New Revision: 1082145

URL: http://svn.apache.org/viewvc?rev=1082145&view=rev
Log:
fix for https://issues.apache.org/jira/browse/AMQNET-320

Modified:
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/QueueBrowser.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/QueueBrowserTests.cs

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/QueueBrowser.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/QueueBrowser.cs?rev=1082145&r1=1082144&r2=1082145&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/QueueBrowser.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/QueueBrowser.cs Wed
Mar 16 13:39:44 2011
@@ -88,6 +88,12 @@ namespace Apache.NMS.ActiveMQ
 			this.browseDone.Value = false;
 			BrowsingMessageConsumer consumer = null;
 
+			if(this.session.Connection.PrefetchPolicy.QueueBrowserPrefetch == 0)
+			{
+				Tracer.Warn("Attempted to create a Queue Browser with Zero sized prefetch buffer.");
+				throw new NMSException("Cannot create a Queue Browser with Zero sized prefetch buffer");
+			}
+			
 			try
 			{
 				consumer = new BrowsingMessageConsumer(

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/QueueBrowserTests.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/QueueBrowserTests.cs?rev=1082145&r1=1082144&r2=1082145&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/QueueBrowserTests.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/QueueBrowserTests.cs
Wed Mar 16 13:39:44 2011
@@ -192,5 +192,18 @@ namespace Apache.NMS.ActiveMQ.Test
 				}
 			}
 		}
+		
+        [Test]
+        [ExpectedException("Apache.NMS.NMSException")]
+        public void TestCreateBrowserFailsWithZeroPrefetch()
+        {
+            using (Connection connection = CreateConnection() as Connection)
+            using (ISession session = connection.CreateSession(AcknowledgementMode.AutoAcknowledge))
+            {
+                connection.PrefetchPolicy.QueueBrowserPrefetch = 0;
+                IQueue queue = session.CreateTemporaryQueue();
+                IQueueBrowser browser = session.CreateBrowser(queue);
+            }
+        }		
 	}
 }



Mime
View raw message