activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r831110 - /activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/policies/RedeliveryPolicy.cs
Date Thu, 29 Oct 2009 22:04:55 GMT
Author: tabish
Date: Thu Oct 29 22:04:55 2009
New Revision: 831110

URL: http://svn.apache.org/viewvc?rev=831110&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQNET-137

Added IRedeliveryPolicy to NMS along with a default Redelivery policy for NMS providers to
use in their IConnectionFactory implementations.  Added the use of the default policy to NMS.ActiveMQ
and used that policy to control the redelivery delay in the MessageConsumers rollback method.

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=831110&r1=831109&r2=831110&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
Thu Oct 29 22:04:55 2009
@@ -27,14 +27,14 @@
     public class RedeliveryPolicy : IRedeliveryPolicy
     {
         private static readonly object syncObject = new object();
-        
+
         private double collisionAvoidanceFactor = .15;
         private int initialRedeliveryDelay = 1000;
         private int maximumRedeliveries = 6;
         private int backOffMultiplier = 5;
         private bool useCollisionAvoidance = false;
         private bool useExponentialBackOff = false;
-        
+
         private static Random randomNumberGenerator;
         private static bool nextBool = false;
 
@@ -67,10 +67,10 @@
         public int RedeliveryDelay(int redeliveredCounter)
         {
             int delay = 0;
-            
+
             if(UseExponentialBackOff && BackOffMultiplier > 1)
             {
-                delay = Convert.ToInt32(initialRedeliveryDelay * (Math.Pow(BackOffMultiplier,
redeliveredCounter)));    
+                delay = Convert.ToInt32(initialRedeliveryDelay * (Math.Pow(BackOffMultiplier,
redeliveredCounter)));
             }
             else
             {
@@ -80,7 +80,7 @@
             if(UseCollisionAvoidance)
             {
                 Random random = RandomNumberGenerator;
-                var variance = (NextBool ? collisionAvoidanceFactor : collisionAvoidanceFactor
*= -1)*random.NextDouble();
+                double variance = (NextBool ? collisionAvoidanceFactor : collisionAvoidanceFactor
*= -1)*random.NextDouble();
                 delay += Convert.ToInt32(Convert.ToDouble(delay) * variance);
             }
 
@@ -92,7 +92,7 @@
             get { return this.useExponentialBackOff; }
             set { this.useExponentialBackOff = value; }
         }
-       
+
         public int BackOffMultiplier
         {
             get { return backOffMultiplier; }
@@ -151,6 +151,6 @@
             // this method is an override.
             return this.MemberwiseClone();
         }
-        
+
     }
 }



Mime
View raw message