Made sure HashedWheelTimer.newTimeout does not throw an IllegalArgumentException for small delay

This commit is contained in:
Trustin Lee 2009-02-08 06:57:40 +00:00
parent 188c7f94aa
commit c46be1c7f9

View File

@ -194,7 +194,9 @@ public class HashedWheelTimer implements Timer {
}
delay = unit.toNanos(delay);
checkDelay(delay);
if (delay < tickDuration) {
delay = tickDuration;
}
if (!workerThread.isAlive()) {
start();
@ -237,13 +239,6 @@ public class HashedWheelTimer implements Timer {
return true;
}
void checkDelay(long delay) {
if (delay < tickDuration) {
throw new IllegalArgumentException(
"delay must be greater than " + tickDuration + " nanoseconds");
}
}
private final class Worker implements Runnable {
private long startTime;