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

davsclaus pushed a commit to branch camel-2.24.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-2.24.x by this push:
     new 5d6fdc3  CAMEL-11750: Fix delay alignment for java 11 (#3241)
5d6fdc3 is described below

commit 5d6fdc3e3ffebb7f6eec0803f3454ac4c08bc702
Author: Viachaslau-Zinkevich <viachaslau.zinkev...@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/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 1158900..005ca54 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
@@ -71,7 +71,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 aligh 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);
             }

Reply via email to