Make sure we handle the sleepTime of 0 correctly in all cases. Thanks to @fredericBregier for review. See #356

This commit is contained in:
Norman Maurer 2012-05-22 23:09:07 +02:00
parent df82853c11
commit 35897027c5

View File

@ -448,9 +448,6 @@ public class HashedWheelTimer implements Timer {
final long currentTime = System.currentTimeMillis();
long sleepTime = tickDuration * tick - (currentTime - startTime);
if (sleepTime <= 0) {
break;
}
// 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
// the JVM if it runs on windows.
@ -460,6 +457,9 @@ public class HashedWheelTimer implements Timer {
sleepTime = (sleepTime / 10) * 10;
}
if (sleepTime <= 0) {
break;
}
try {
Thread.sleep(sleepTime);
} catch (InterruptedException e) {