From c1a76a06a8e60b4dd97041611ca3521ca6fc322a Mon Sep 17 00:00:00 2001 From: YHRivory <104285289+Bentley-William@users.noreply.github.com> Date: Tue, 28 Jun 2022 19:37:38 +0800 Subject: [PATCH] typo: WhellTimer.Woker run method typo. (#10226) --- .../apache/dubbo/common/timer/HashedWheelTimer.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/timer/HashedWheelTimer.java b/dubbo-common/src/main/java/org/apache/dubbo/common/timer/HashedWheelTimer.java index 487cc74ba..fd9cf7173 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/timer/HashedWheelTimer.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/timer/HashedWheelTimer.java @@ -429,11 +429,8 @@ public class HashedWheelTimer implements Timer { @Override public void run() { // Initialize the startTime. - startTime = System.nanoTime(); - if (startTime == 0) { - // We use 0 as an indicator for the uninitialized value here, so make sure it's not 0 when initialized. - startTime = 1; - } + // We use 0 as an indicator for the uninitialized value here, so make sure it's not 0 when initialized. + startTime = Math.max(System.nanoTime(), 1); // Notify the other threads waiting for the initialization at start(). startTimeInitialized.countDown(); @@ -443,15 +440,14 @@ public class HashedWheelTimer implements Timer { if (deadline > 0) { int idx = (int) (tick & mask); processCancelledTasks(); - HashedWheelBucket bucket = - wheel[idx]; + HashedWheelBucket bucket = wheel[idx]; transferTimeoutsToBuckets(); bucket.expireTimeouts(deadline); tick++; } } while (WORKER_STATE_UPDATER.get(HashedWheelTimer.this) == WORKER_STATE_STARTED); - // Fill the unprocessedTimeouts so we can return them from stop() method. + // Fill the unprocessedTimeouts, so we can return them from stop() method. for (HashedWheelBucket bucket : wheel) { bucket.clearTimeouts(unprocessedTimeouts); } -- GitLab