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 b819537bc9a (chores) camel-base-engine: break a few large methods
b819537bc9a is described below
commit b819537bc9a1fa9f419bd131bc090990e3f1a4ab
Author: Otavio Rodolfo Piske <[email protected]>
AuthorDate: Thu Apr 27 20:13:41 2023 +0200
(chores) camel-base-engine: break a few large methods
This should help the profiler to provide useful information
---
.../camel/impl/engine/DefaultReactiveExecutor.java | 50 ++++++++++++----------
1 file changed, 27 insertions(+), 23 deletions(-)
diff --git
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultReactiveExecutor.java
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultReactiveExecutor.java
index 2930c025095..35a05842cf6 100644
---
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultReactiveExecutor.java
+++
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultReactiveExecutor.java
@@ -161,29 +161,7 @@ public class DefaultReactiveExecutor extends
ServiceSupport implements ReactiveE
executor.runningWorkers.increment();
}
try {
- for (;;) {
- final Runnable polled = queue.pollFirst();
- if (polled == null) {
- if (back != null && !back.isEmpty()) {
- queue = back.pollFirst();
- continue;
- } else {
- break;
- }
- }
- try {
- if (stats) {
- executor.pendingTasks.decrement();
- }
- if (LOG.isTraceEnabled()) {
- LOG.trace("Worker #{} running: {}", number,
polled);
- }
- polled.run();
- } catch (Throwable t) {
- LOG.warn("Error executing reactive work due to {}.
This exception is ignored.",
- t.getMessage(), t);
- }
- }
+ executeReactiveWork();
} finally {
running = false;
if (stats) {
@@ -197,6 +175,32 @@ public class DefaultReactiveExecutor extends
ServiceSupport implements ReactiveE
}
}
+ private void executeReactiveWork() {
+ for (;;) {
+ final Runnable polled = queue.pollFirst();
+ if (polled == null) {
+ if (back != null && !back.isEmpty()) {
+ queue = back.pollFirst();
+ continue;
+ } else {
+ break;
+ }
+ }
+ try {
+ if (stats) {
+ executor.pendingTasks.decrement();
+ }
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Worker #{} running: {}", number, polled);
+ }
+ polled.run();
+ } catch (Throwable t) {
+ LOG.warn("Error executing reactive work due to {}. This
exception is ignored.",
+ t.getMessage(), t);
+ }
+ }
+ }
+
boolean executeFromQueue() {
final Runnable polled = queue != null ? queue.pollFirst() : null;
if (polled == null) {