This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new c1a76a06a8 typo: WhellTimer.Woker run method typo. (#10226)
c1a76a06a8 is described below
commit c1a76a06a8e60b4dd97041611ca3521ca6fc322a
Author: YHRivory <[email protected]>
AuthorDate: Tue Jun 28 19:37:38 2022 +0800
typo: WhellTimer.Woker run method typo. (#10226)
---
.../java/org/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 487cc74ba5..fd9cf71737 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);
}