CAMEL-11750: Camel route with multicast (parallel) generate huge CPU load

Fixed issue with huge CPU load: added 1 second delay for a task that is 2nd in 
the queue order, 2sec for 3rd task, 3sec for 4th taks, etc. That helps to 
decrease CPU load and does not broke previous logic.

Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c5042d96
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c5042d96
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c5042d96

Branch: refs/heads/master
Commit: c5042d965dde0a47761015d22931bf871ddc3bca
Parents: da4b458
Author: leofromgroza <vishka.na...@gmail.com>
Authored: Thu Sep 7 11:15:02 2017 +0300
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Fri Sep 8 10:16:49 2017 +0200

----------------------------------------------------------------------
 .../camel/util/concurrent/SubmitOrderedCompletionService.java      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/c5042d96/camel-core/src/main/java/org/apache/camel/util/concurrent/SubmitOrderedCompletionService.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/util/concurrent/SubmitOrderedCompletionService.java
 
b/camel-core/src/main/java/org/apache/camel/util/concurrent/SubmitOrderedCompletionService.java
index 4af4553..f828427 100644
--- 
a/camel-core/src/main/java/org/apache/camel/util/concurrent/SubmitOrderedCompletionService.java
+++ 
b/camel-core/src/main/java/org/apache/camel/util/concurrent/SubmitOrderedCompletionService.java
@@ -63,7 +63,7 @@ public class SubmitOrderedCompletionService<V> implements 
CompletionService<V> {
 
         public long getDelay(TimeUnit unit) {
             // if the answer is 0 then this task is ready to be taken
-            return id - index.get();
+            return unit.convert(id - index.get(), TimeUnit.SECONDS);
         }
 
         @SuppressWarnings("unchecked")

Reply via email to