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/11/01 00:48:04 UTC

svn commit: r831619 - /activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/policies/RedeliveryPolicy.cs

Author: tabish
Date: Sat Oct 31 23:48:04 2009
New Revision: 831619

URL: http://svn.apache.org/viewvc?rev=831619&view=rev
Log:
* RedeliveryPolicy.cs: 

Update policy to enforce that the zeroth redelivery has no delay, the initial rollback should not be delayed.

Modified:
    activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/policies/RedeliveryPolicy.cs

Modified: activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/policies/RedeliveryPolicy.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/policies/RedeliveryPolicy.cs?rev=831619&r1=831618&r2=831619&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/policies/RedeliveryPolicy.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/policies/RedeliveryPolicy.cs Sat Oct 31 23:48:04 2009
@@ -65,10 +65,16 @@
         public int RedeliveryDelay(int redeliveredCounter)
         {
             int delay = 0;
+            
+            if(redeliveredCounter == 0)
+            {
+                // The first time through there is no delay, the Rollback should be immediate.
+                return 0;
+            }
 
             if(UseExponentialBackOff && BackOffMultiplier > 1)
             {
-                delay = Convert.ToInt32(initialRedeliveryDelay * (Math.Pow(BackOffMultiplier, redeliveredCounter)));
+                delay = initialRedeliveryDelay * Convert.ToInt32(Math.Pow(BackOffMultiplier, redeliveredCounter - 1));
             }
             else
             {