Author: davsclaus
Date: Tue Nov  3 08:48:16 2009
New Revision: 832342

URL: http://svn.apache.org/viewvc?rev=832342&view=rev
Log:
CAMEL-1048: Renamed the throttler as we will in the future add another 
throttler that is messages per time unit based.

Added:
    
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ThrottlingInflightRoutePolicy.java
   (contents, props changed)
      - copied, changed from r831887, 
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ThrottlingRoutePolicy.java
    
camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedThrottlingInflightRoutePolicy.java
   (contents, props changed)
      - copied, changed from r831887, 
camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedThrottlingRoutePolicy.java
    
camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThrottlingInflightRoutePolicyTest.java
   (contents, props changed)
      - copied, changed from r831887, 
camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThrottlingRoutePolicyTest.java
    
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringThrottlingInflightRoutePolicyTest.java
   (contents, props changed)
      - copied, changed from r831887, 
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringThrottlingRoutePolicyTest.java
    
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThrottlingInflightRoutePolicyTest.xml
   (contents, props changed)
      - copied, changed from r831887, 
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThrottlingRoutePolicyTest.xml
Removed:
    
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ThrottlingRoutePolicy.java
    
camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedThrottlingRoutePolicy.java
    
camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThrottlingRoutePolicyTest.java
    
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringThrottlingRoutePolicyTest.java
    
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThrottlingRoutePolicyTest.xml
Modified:
    
camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/spi/RoutePolicy.java
    
camel/trunk/examples/camel-example-route-throttling/src/main/resources/META-INF/spring/camel-server.xml

Copied: 
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ThrottlingInflightRoutePolicy.java
 (from r831887, 
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ThrottlingRoutePolicy.java)
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ThrottlingInflightRoutePolicy.java?p2=camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ThrottlingInflightRoutePolicy.java&p1=camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ThrottlingRoutePolicy.java&r1=831887&r2=832342&rev=832342&view=diff
==============================================================================
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ThrottlingRoutePolicy.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ThrottlingInflightRoutePolicy.java
 Tue Nov  3 08:48:16 2009
@@ -33,7 +33,7 @@
  *
  * @version $Revision$
  */
-public class ThrottlingRoutePolicy extends RoutePolicySupport {
+public class ThrottlingInflightRoutePolicy extends RoutePolicySupport {
 
     public enum ThrottlingScope {
         Context, Route
@@ -47,12 +47,12 @@
     private LoggingLevel loggingLevel = LoggingLevel.INFO;
     private Logger logger;
 
-    public ThrottlingRoutePolicy() {
+    public ThrottlingInflightRoutePolicy() {
     }
 
     @Override
     public String toString() {
-        return "ThrottlingRoutePolicy[" + maxInflightExchanges + " / " + 
resumePercentOfMax + "% using scope " + scope + "]";
+        return "ThrottlingInflightRoutePolicy[" + maxInflightExchanges + " / " 
+ resumePercentOfMax + "% using scope " + scope + "]";
     }
 
     public void onExchangeDone(Route route, Exchange exchange) {
@@ -117,7 +117,7 @@
      */
     public void setResumePercentOfMax(int resumePercentOfMax) {
         if (resumePercentOfMax < 0 || resumePercentOfMax > 100) {
-            throw new IllegalArgumentException("reconnectPercentOfMax must be 
a percentage between 0 and 100");
+            throw new IllegalArgumentException("Must be a percentage between 0 
and 100, was: " + resumePercentOfMax);
         }
 
         this.resumePercentOfMax = resumePercentOfMax;
@@ -170,7 +170,7 @@
     }
 
     protected Logger createLogger() {
-        return new Logger(LogFactory.getLog(ThrottlingRoutePolicy.class), 
getLoggingLevel());
+        return new 
Logger(LogFactory.getLog(ThrottlingInflightRoutePolicy.class), 
getLoggingLevel());
     }
 
     private int getSize(Consumer consumer, Exchange exchange) {

Propchange: 
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ThrottlingInflightRoutePolicy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ThrottlingInflightRoutePolicy.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java?rev=832342&r1=832341&r2=832342&view=diff
==============================================================================
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
 Tue Nov  3 08:48:16 2009
@@ -34,7 +34,7 @@
 import org.apache.camel.builder.ErrorHandlerBuilder;
 import org.apache.camel.impl.EventDrivenConsumerRoute;
 import org.apache.camel.impl.ScheduledPollConsumer;
-import org.apache.camel.impl.ThrottlingRoutePolicy;
+import org.apache.camel.impl.ThrottlingInflightRoutePolicy;
 import org.apache.camel.management.mbean.ManagedBrowsableEndpoint;
 import org.apache.camel.management.mbean.ManagedCamelContext;
 import org.apache.camel.management.mbean.ManagedComponent;
@@ -50,7 +50,7 @@
 import org.apache.camel.management.mbean.ManagedSendProcessor;
 import org.apache.camel.management.mbean.ManagedService;
 import org.apache.camel.management.mbean.ManagedThrottler;
-import org.apache.camel.management.mbean.ManagedThrottlingRoutePolicy;
+import org.apache.camel.management.mbean.ManagedThrottlingInflightRoutePolicy;
 import org.apache.camel.management.mbean.ManagedTracer;
 import org.apache.camel.model.AOPDefinition;
 import org.apache.camel.model.InterceptDefinition;
@@ -288,8 +288,8 @@
         } else if (service instanceof Processor) {
             // special for processors
             return getManagedObjectForProcessor(context, (Processor) service, 
route);
-        } else if (service instanceof ThrottlingRoutePolicy) {
-            answer = new ManagedThrottlingRoutePolicy(context, 
(ThrottlingRoutePolicy) service);
+        } else if (service instanceof ThrottlingInflightRoutePolicy) {
+            answer = new ManagedThrottlingInflightRoutePolicy(context, 
(ThrottlingInflightRoutePolicy) service);
         } else if (service != null) {
             // fallback as generic service
             answer = new ManagedService(context, service);

Copied: 
camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedThrottlingInflightRoutePolicy.java
 (from r831887, 
camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedThrottlingRoutePolicy.java)
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedThrottlingInflightRoutePolicy.java?p2=camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedThrottlingInflightRoutePolicy.java&p1=camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedThrottlingRoutePolicy.java&r1=831887&r2=832342&rev=832342&view=diff
==============================================================================
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedThrottlingRoutePolicy.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedThrottlingInflightRoutePolicy.java
 Tue Nov  3 08:48:16 2009
@@ -18,24 +18,24 @@
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.LoggingLevel;
-import org.apache.camel.impl.ThrottlingRoutePolicy;
+import org.apache.camel.impl.ThrottlingInflightRoutePolicy;
 import org.springframework.jmx.export.annotation.ManagedAttribute;
 import org.springframework.jmx.export.annotation.ManagedResource;
 
 /**
  * @version $Revision$
  */
-...@managedresource(description = "Managed ThrottlingRoutePolicy")
-public class ManagedThrottlingRoutePolicy extends ManagedService {
+...@managedresource(description = "Managed ThrottlingInflightRoutePolicy")
+public class ManagedThrottlingInflightRoutePolicy extends ManagedService {
 
-    private final ThrottlingRoutePolicy policy;
+    private final ThrottlingInflightRoutePolicy policy;
 
-    public ManagedThrottlingRoutePolicy(CamelContext context, 
ThrottlingRoutePolicy policy) {
+    public ManagedThrottlingInflightRoutePolicy(CamelContext context, 
ThrottlingInflightRoutePolicy policy) {
         super(context, policy);
         this.policy = policy;
     }
 
-    public ThrottlingRoutePolicy getPolicy() {
+    public ThrottlingInflightRoutePolicy getPolicy() {
         return policy;
     }
 
@@ -66,7 +66,7 @@
 
     @ManagedAttribute(description = "Scope")
     public void setScope(String scope) {
-        
getPolicy().setScope(ThrottlingRoutePolicy.ThrottlingScope.valueOf(scope));
+        
getPolicy().setScope(ThrottlingInflightRoutePolicy.ThrottlingScope.valueOf(scope));
     }
 
     @ManagedAttribute(description = "Logging Level")

Propchange: 
camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedThrottlingInflightRoutePolicy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedThrottlingInflightRoutePolicy.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/spi/RoutePolicy.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/RoutePolicy.java?rev=832342&r1=832341&r2=832342&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/spi/RoutePolicy.java 
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/spi/RoutePolicy.java 
Tue Nov  3 08:48:16 2009
@@ -22,7 +22,7 @@
 /**
  * Policy for a {...@link Route} which allows controlling the route at runtime.
  * <p/>
- * For example using the {...@link 
org.apache.camel.impl.ThrottlingRoutePolicy} to throttle the {...@link Route}
+ * For example using the {...@link 
org.apache.camel.impl.ThrottlingInflightRoutePolicy} to throttle the {...@link 
Route}
  * at runtime where it suspends and resume the {...@link 
org.apache.camel.Route#getConsumer()}.
  *
  * @version $Revision$

Copied: 
camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThrottlingInflightRoutePolicyTest.java
 (from r831887, 
camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThrottlingRoutePolicyTest.java)
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThrottlingInflightRoutePolicyTest.java?p2=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThrottlingInflightRoutePolicyTest.java&p1=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThrottlingRoutePolicyTest.java&r1=831887&r2=832342&rev=832342&view=diff
==============================================================================
--- 
camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThrottlingRoutePolicyTest.java
 (original)
+++ 
camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThrottlingInflightRoutePolicyTest.java
 Tue Nov  3 08:48:16 2009
@@ -18,23 +18,23 @@
 
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.impl.ThrottlingRoutePolicy;
+import org.apache.camel.impl.ThrottlingInflightRoutePolicy;
 
 /**
  * @version $Revision$
  */
-public class ThrottlingRoutePolicyTest extends ContextTestSupport {
+public class ThrottlingInflightRoutePolicyTest extends ContextTestSupport {
 
     private String url = "seda:foo?concurrentConsumers=20";
     private int size = 100;
 
     public void testThrottlingRoutePolicy() throws Exception {
+        getMockEndpoint("mock:result").expectedMinimumMessageCount(size - 5);
+
         for (int i = 0; i < size; i++) {
             template.sendBody(url, "Message " + i);
         }
 
-        getMockEndpoint("mock:result").expectedMessageCount(size);
-
         // now start the route
         context.startRoute("myRoute");
 
@@ -46,7 +46,7 @@
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                ThrottlingRoutePolicy policy = new ThrottlingRoutePolicy();
+                ThrottlingInflightRoutePolicy policy = new 
ThrottlingInflightRoutePolicy();
                 policy.setMaxInflightExchanges(10);
 
                 from(url)

Propchange: 
camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThrottlingInflightRoutePolicyTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThrottlingInflightRoutePolicyTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: 
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringThrottlingInflightRoutePolicyTest.java
 (from r831887, 
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringThrottlingRoutePolicyTest.java)
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringThrottlingInflightRoutePolicyTest.java?p2=camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringThrottlingInflightRoutePolicyTest.java&p1=camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringThrottlingRoutePolicyTest.java&r1=831887&r2=832342&rev=832342&view=diff
==============================================================================
--- 
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringThrottlingRoutePolicyTest.java
 (original)
+++ 
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringThrottlingInflightRoutePolicyTest.java
 Tue Nov  3 08:48:16 2009
@@ -17,15 +17,15 @@
 package org.apache.camel.spring.processor;
 
 import org.apache.camel.CamelContext;
-import org.apache.camel.processor.ThrottlingRoutePolicyTest;
+import org.apache.camel.processor.ThrottlingInflightRoutePolicyTest;
 import static 
org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
 
 /**
  * @version $Revision$
  */
-public class SpringThrottlingRoutePolicyTest extends ThrottlingRoutePolicyTest 
{
+public class SpringThrottlingInflightRoutePolicyTest extends 
ThrottlingInflightRoutePolicyTest {
 
     protected CamelContext createCamelContext() throws Exception {
-        return createSpringCamelContext(this, 
"org/apache/camel/spring/processor/ThrottlingRoutePolicyTest.xml");
+        return createSpringCamelContext(this, 
"org/apache/camel/spring/processor/ThrottlingInflightRoutePolicyTest.xml");
     }
 }
\ No newline at end of file

Propchange: 
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringThrottlingInflightRoutePolicyTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringThrottlingInflightRoutePolicyTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: 
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThrottlingInflightRoutePolicyTest.xml
 (from r831887, 
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThrottlingRoutePolicyTest.xml)
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThrottlingInflightRoutePolicyTest.xml?p2=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThrottlingInflightRoutePolicyTest.xml&p1=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThrottlingRoutePolicyTest.xml&r1=831887&r2=832342&rev=832342&view=diff
==============================================================================
--- 
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThrottlingRoutePolicyTest.xml
 (original)
+++ 
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThrottlingInflightRoutePolicyTest.xml
 Tue Nov  3 08:48:16 2009
@@ -24,7 +24,7 @@
 
     <!-- START SNIPPET: e1 -->
     <!-- configure our route policy to throttling based -->
-    <bean id="myRoutePolicy" 
class="org.apache.camel.impl.ThrottlingRoutePolicy">
+    <bean id="myRoutePolicy" 
class="org.apache.camel.impl.ThrottlingInflightRoutePolicy">
         <!-- we want at most 10 concurrent inflight exchanges -->
         <property name="maxInflightExchanges" value="10"/>
         <!-- and we want a low water mark value of 20% of the max which means 
that

Propchange: 
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThrottlingInflightRoutePolicyTest.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThrottlingInflightRoutePolicyTest.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: 
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ThrottlingInflightRoutePolicyTest.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: 
camel/trunk/examples/camel-example-route-throttling/src/main/resources/META-INF/spring/camel-server.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-route-throttling/src/main/resources/META-INF/spring/camel-server.xml?rev=832342&r1=832341&r2=832342&view=diff
==============================================================================
--- 
camel/trunk/examples/camel-example-route-throttling/src/main/resources/META-INF/spring/camel-server.xml
 (original)
+++ 
camel/trunk/examples/camel-example-route-throttling/src/main/resources/META-INF/spring/camel-server.xml
 Tue Nov  3 08:48:16 2009
@@ -41,7 +41,7 @@
     </bean>
 
     <!-- START SNIPPET: e1 -->
-    <bean id="myPolicy" class="org.apache.camel.impl.ThrottlingRoutePolicy">
+    <bean id="myPolicy" 
class="org.apache.camel.impl.ThrottlingInflightRoutePolicy">
         <!-- define the scope to be context scoped so we measure against total 
inflight exchanges
              that means for both route1, route2 and route3 all together -->
         <property name="scope" value="Context"/>


Reply via email to