This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push: new baf7cd4 CAMEL-16279: camel-core - Optimize core to reduce object allocations by pooloing reusable tasks in the routing engine. baf7cd4 is described below commit baf7cd432cd528f2cb07d394383db3166921979b Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Wed Mar 10 07:44:08 2021 +0100 CAMEL-16279: camel-core - Optimize core to reduce object allocations by pooloing reusable tasks in the routing engine. --- .../apache/camel/impl/engine/CamelInternalProcessor.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/CamelInternalProcessor.java b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/CamelInternalProcessor.java index 3efa6f6..80b037e 100644 --- a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/CamelInternalProcessor.java +++ b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/CamelInternalProcessor.java @@ -322,8 +322,16 @@ public class CamelInternalProcessor extends DelegateAsyncProcessor implements In states[j++] = state; } } catch (Throwable e) { + // error in before so break out exchange.setException(e); - originalCallback.done(true); + try { + originalCallback.done(true); + } finally { + // task is done so reset + if (taskFactory != null) { + taskFactory.release(afterTask); + } + } return true; } } @@ -345,11 +353,14 @@ public class CamelInternalProcessor extends DelegateAsyncProcessor implements In } catch (Throwable e) { exchange.setException(e); } finally { + // processing is done afterTask.done(true); + // task is done so reset if (taskFactory != null) { taskFactory.release(afterTask); } } + // we are done synchronously - must return true return true; } else { final UnitOfWork uow = exchange.getUnitOfWork(); @@ -383,7 +394,7 @@ public class CamelInternalProcessor extends DelegateAsyncProcessor implements In LOG.trace("Exchange processed and is continued routed asynchronously for exchangeId: {} -> {}", exchange.getExchangeId(), exchange); } - // must return false + // we are done asynchronously - must return false return false; } }