You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2023/12/20 19:58:47 UTC

(camel) branch main updated: CAMEL-20225: reduce clock instantiation overhead (#12513)

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 d7d5aa28161 CAMEL-20225: reduce clock instantiation overhead (#12513)
d7d5aa28161 is described below

commit d7d5aa281614cebc33febc0b28886e40b2bbdc6a
Author: Otavio Rodolfo Piske <or...@users.noreply.github.com>
AuthorDate: Wed Dec 20 16:58:39 2023 -0300

    CAMEL-20225: reduce clock instantiation overhead (#12513)
---
 .../src/main/java/org/apache/camel/support/MonotonicClock.java        | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/core/camel-support/src/main/java/org/apache/camel/support/MonotonicClock.java b/core/camel-support/src/main/java/org/apache/camel/support/MonotonicClock.java
index 1642f57dfae..9a28d8b37e8 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/MonotonicClock.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/MonotonicClock.java
@@ -22,11 +22,9 @@ import java.util.concurrent.TimeUnit;
 import org.apache.camel.Clock;
 
 public class MonotonicClock implements Clock {
-    private final long created;
     private final long createdNano;
 
     MonotonicClock() {
-        this.created = System.currentTimeMillis();
         this.createdNano = System.nanoTime();
     }
 
@@ -37,6 +35,6 @@ public class MonotonicClock implements Clock {
 
     @Override
     public long getCreated() {
-        return created;
+        return System.currentTimeMillis() - elapsed();
     }
 }