pinxiong commented on a change in pull request #8954:
URL: https://github.com/apache/dubbo/pull/8954#discussion_r729791332
##########
File path:
dubbo-common/src/main/java/org/apache/dubbo/common/timer/HashedWheelTimer.java
##########
@@ -521,18 +559,18 @@ private long waitForNextTick() {
long deadline = tickDuration * (tick + 1);
for (; ; ) {
+ // the currentTime will be negative only if the application
must keep running last more than 262 years.
final long currentTime = System.nanoTime() - startTime;
long sleepTimeMs = (deadline - currentTime + 999999) / 1000000;
if (sleepTimeMs <= 0) {
- if (currentTime == Long.MIN_VALUE) {
- return -Long.MAX_VALUE;
- } else {
- return currentTime;
- }
+ return currentTime;
Review comment:
Thanks for letting me know! Yes, you're right!
But I wonder why Netty team didn't do this, although they merged
https://github.com/netty/netty/pull/11728
Why don't we keep the same with them, because dubbo is a fully referenced
Netty‘s implementation of
[HashedWheelTimer](https://github.com/netty/netty/blob/4.1/common/src/main/java/io/netty/util/HashedWheelTimer.java#L581).
Essentially, as long as the returned value of
[HashedWheelTimer#waitForNextTick](https://github.com/netty/netty/blob/4.1/common/src/main/java/io/netty/util/HashedWheelTimer.java#L572)
is negative, it doesn't matter
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]