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/21 00:34:30 UTC

(camel) 02/02: CAMEL-20225: converted camel-box to the StopWatch

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

commit e3abac39358898080d7ab5ee467cf6edcc8fd55e
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Wed Dec 20 16:57:55 2023 -0300

    CAMEL-20225: converted camel-box to the StopWatch
---
 .../java/org/apache/camel/component/box/api/BoxFilesManager.java    | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxFilesManager.java b/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxFilesManager.java
index ac645f116a7..90e20235c24 100644
--- a/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxFilesManager.java
+++ b/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxFilesManager.java
@@ -37,6 +37,7 @@ import com.box.sdk.Metadata;
 import com.box.sdk.ProgressListener;
 import com.box.sdk.sharedlink.BoxSharedLinkRequest;
 import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.util.StopWatch;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -157,7 +158,7 @@ public class BoxFilesManager {
                         // for faster results, we recommend the folder to contain no more than 500 items
                         // otherwise it can take more time to iterate over all items to check if the filename exists
                         // display a WARN if the delay is higher than 5s
-                        long init = System.currentTimeMillis();
+                        final StopWatch watch = new StopWatch();
                         int delayLimit = 5;
                         boolean exists = false;
 
@@ -174,8 +175,7 @@ public class BoxFilesManager {
                                 }
                             }
                         }
-                        long end = System.currentTimeMillis();
-                        long elapsed = (end - init) / 1000;
+                        long elapsed = watch.taken();
                         if (elapsed > delayLimit) {
                             LOG.warn(
                                     "The upload operation, checks if the file exists by using the Box list folder, however it took {}"