You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2023/10/19 06:30:27 UTC

[camel] branch main updated: (chores) camel-core: minor cleanup in the RedeliveryErrorHandler

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

orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 422fbb2ff5f (chores) camel-core: minor cleanup in the RedeliveryErrorHandler
422fbb2ff5f is described below

commit 422fbb2ff5f5079e34cda6d9162ffa8f4f1a454c
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Wed Oct 18 17:15:26 2023 +0200

    (chores) camel-core: minor cleanup in the RedeliveryErrorHandler
    
    - Remove unnecessary variables
    - Use final when possible
    - Consolidate code
---
 .../processor/errorhandler/RedeliveryErrorHandler.java     | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/core/camel-core-processor/src/main/java/org/apache/camel/processor/errorhandler/RedeliveryErrorHandler.java b/core/camel-core-processor/src/main/java/org/apache/camel/processor/errorhandler/RedeliveryErrorHandler.java
index a35f89616cb..f85d98e9481 100644
--- a/core/camel-core-processor/src/main/java/org/apache/camel/processor/errorhandler/RedeliveryErrorHandler.java
+++ b/core/camel-core-processor/src/main/java/org/apache/camel/processor/errorhandler/RedeliveryErrorHandler.java
@@ -420,17 +420,11 @@ public abstract class RedeliveryErrorHandler extends ErrorHandlerSupport
         @Override
         public void run() {
             // can we still run
-            boolean run = true;
-            if (shutdownStrategy.isForceShutdown()) {
-                run = false;
-            }
-            if (run && isStoppingOrStopped()) {
-                run = false;
-            }
-            if (!run) {
+            if (shutdownStrategy.isForceShutdown() || isStoppingOrStopped()) {
                 runNotAllowed();
                 return;
             }
+
             if (exchange.getExchangeExtension().isInterrupted()) {
                 runInterrupted();
                 return;
@@ -439,11 +433,11 @@ public abstract class RedeliveryErrorHandler extends ErrorHandlerSupport
             // only new failure if the exchange has exception
             // and it has not been handled by the failure processor before
             // or not exhausted
-            boolean failure = exchange.getException() != null
+            final boolean failure = exchange.getException() != null
                     && !exchange.getExchangeExtension().isRedeliveryExhausted()
                     && !ExchangeHelper.isFailureHandled(exchange);
             // error handled bridged
-            boolean bridge = ExchangeHelper.isErrorHandlerBridge(exchange);
+            final boolean bridge = ExchangeHelper.isErrorHandlerBridge(exchange);
 
             if (failure || bridge) {
                 // previous processing cause an exception