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:14:50 UTC

[camel] branch camel-2.x 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 camel-2.x
in repository https://gitbox.apache.org/repos/asf/camel.git


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

commit 1aded627572ac3f5d69f50c72c5376bf49404df2
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/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);
             }