You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2019/10/11 03:16:52 UTC

[camel] branch master updated: CAMEL-11750: Fix delay alignment for java 11 (#3241)

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 ddac42e  CAMEL-11750: Fix delay alignment for java 11 (#3241)
ddac42e is described below

commit ddac42e0540a38bb9c08ac4ff09f511a02ae20b4
Author: Viachaslau-Zinkevich <vi...@outlook.com>
AuthorDate: Fri Oct 11 06:12:13 2019 +0300

    CAMEL-11750: Fix delay alignment for java 11 (#3241)
---
 .../apache/camel/util/concurrent/SubmitOrderedCompletionService.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/core/camel-util/src/main/java/org/apache/camel/util/concurrent/SubmitOrderedCompletionService.java b/core/camel-util/src/main/java/org/apache/camel/util/concurrent/SubmitOrderedCompletionService.java
index cc8f6ae..b462c8f 100644
--- a/core/camel-util/src/main/java/org/apache/camel/util/concurrent/SubmitOrderedCompletionService.java
+++ b/core/camel-util/src/main/java/org/apache/camel/util/concurrent/SubmitOrderedCompletionService.java
@@ -70,7 +70,10 @@ public class SubmitOrderedCompletionService<V> implements CompletionService<V> {
             // so we have to return a delay value of one time unit
             if (TimeUnit.NANOSECONDS == unit) {
                 // okay this is too fast so use a little more delay to avoid CPU burning cycles
-                answer = unit.convert(1, TimeUnit.MICROSECONDS);
+                // To avoid align with java 11 impl of
+                // "java.util.concurrent.locks.AbstractQueuedSynchronizer.SPIN_FOR_TIMEOUT_THRESHOLD", otherwise
+                // no sleep with very high CPU usage
+                answer = 1001L;
             } else {
                 answer = unit.convert(1, unit);
             }