Make sure we handle the sleepTime of 0 correctly in all cases. Thanks to @fredericBregier for review. See #356
This commit is contained in:
parent
df82853c11
commit
35897027c5
@ -448,9 +448,6 @@ public class HashedWheelTimer implements Timer {
|
|||||||
final long currentTime = System.currentTimeMillis();
|
final long currentTime = System.currentTimeMillis();
|
||||||
long sleepTime = tickDuration * tick - (currentTime - startTime);
|
long sleepTime = tickDuration * tick - (currentTime - startTime);
|
||||||
|
|
||||||
if (sleepTime <= 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// Check if we run on windows, as if thats the case we will need
|
// Check if we run on windows, as if thats the case we will need
|
||||||
// to round the sleepTime as workaround for a bug that only affect
|
// to round the sleepTime as workaround for a bug that only affect
|
||||||
// the JVM if it runs on windows.
|
// the JVM if it runs on windows.
|
||||||
@ -460,6 +457,9 @@ public class HashedWheelTimer implements Timer {
|
|||||||
sleepTime = (sleepTime / 10) * 10;
|
sleepTime = (sleepTime / 10) * 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sleepTime <= 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
Thread.sleep(sleepTime);
|
Thread.sleep(sleepTime);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user