This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch 
investigate-and-fix-camel-24268-throttlinginfligh
in repository https://gitbox.apache.org/repos/asf/camel.git

commit f8878e4db9fd860b04ee82ab808cc66a38cfcfbb
Author: Guillaume Nodet <[email protected]>
AuthorDate: Wed Jul 29 08:12:37 2026 +0200

    CAMEL-24268: Remove write-only resumeInflightExchanges field
    
    After the ThrottlingLimits holder refactoring in PR #24985 (CAMEL-24227),
    the standalone resumeInflightExchanges field became dead code: written by
    setMaxInflightExchanges() and setResumePercentOfMax() but never read —
    throttle() reads from the holder record instead.
    
    - Remove the dead resumeInflightExchanges field
    - Remove the two dead writes in the setter methods
    - Derive the initial holder default programmatically (70 * 1000 / 100)
      instead of duplicating the literal 700
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
---
 .../org/apache/camel/throttling/ThrottlingInflightRoutePolicy.java  | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git 
a/core/camel-support/src/main/java/org/apache/camel/throttling/ThrottlingInflightRoutePolicy.java
 
b/core/camel-support/src/main/java/org/apache/camel/throttling/ThrottlingInflightRoutePolicy.java
index 9a54ef0d92c6..f27eb327f84b 100644
--- 
a/core/camel-support/src/main/java/org/apache/camel/throttling/ThrottlingInflightRoutePolicy.java
+++ 
b/core/camel-support/src/main/java/org/apache/camel/throttling/ThrottlingInflightRoutePolicy.java
@@ -78,13 +78,13 @@ public class ThrottlingInflightRoutePolicy extends 
RoutePolicySupport implements
     @Metadata(description = "Sets at which percentage of the max the throttler 
should start resuming the route.",
               defaultValue = "70")
     private volatile int resumePercentOfMax = 70;
-    private volatile int resumeInflightExchanges = 700;
 
     // immutable holder for throttling limits that must be visible atomically 
on routing threads
     private record ThrottlingLimits(int maxInflightExchanges, int 
resumeInflightExchanges) {
     }
 
-    private volatile ThrottlingLimits throttlingLimits = new 
ThrottlingLimits(1000, 700);
+    private volatile ThrottlingLimits throttlingLimits
+            = new ThrottlingLimits(1000, Math.max(70 * 1000 / 100, 1));
 
     @Metadata(description = "Sets the logging level to report the throttling 
activity.",
               javaType = "org.apache.camel.LoggingLevel", defaultValue = 
"INFO", enums = "TRACE,DEBUG,INFO,WARN,ERROR,OFF")
@@ -191,7 +191,6 @@ public class ThrottlingInflightRoutePolicy extends 
RoutePolicySupport implements
         this.maxInflightExchanges = maxInflightExchanges;
         // recalculate, must be at least at 1
         int resume = Math.max(resumePercentOfMax * maxInflightExchanges / 100, 
1);
-        this.resumeInflightExchanges = resume;
         // atomically publish both values for routing threads
         this.throttlingLimits = new ThrottlingLimits(maxInflightExchanges, 
resume);
     }
@@ -215,7 +214,6 @@ public class ThrottlingInflightRoutePolicy extends 
RoutePolicySupport implements
         this.resumePercentOfMax = resumePercentOfMax;
         // recalculate, must be at least at 1
         int resume = Math.max(resumePercentOfMax * maxInflightExchanges / 100, 
1);
-        this.resumeInflightExchanges = resume;
         // atomically publish both values for routing threads
         this.throttlingLimits = new ThrottlingLimits(maxInflightExchanges, 
resume);
     }

Reply via email to