#2102 - porting over the fix for Netty/356
This commit is contained in:
parent
c357ba426e
commit
260e281449
1 changed files with 12 additions and 1 deletions
|
|
@ -89,6 +89,7 @@ public class HashedWheelTimer implements Timer {
|
|||
final ReusableIterator<HashedWheelTimeout>[] iterators;
|
||||
final int mask;
|
||||
final ReadWriteLock lock = new ReentrantReadWriteLock();
|
||||
final boolean isWindows = System.getProperty("os.name", "").toLowerCase().indexOf("win") >= 0;
|
||||
volatile int wheelCursor;
|
||||
private LoggingAdapter logger;
|
||||
|
||||
|
|
@ -389,7 +390,17 @@ public class HashedWheelTimer implements Timer {
|
|||
|
||||
for (;;) {
|
||||
final long currentTime = System.nanoTime();
|
||||
final long sleepTime = (tickDuration * tick - (currentTime - startTime));
|
||||
|
||||
long sleepTime = tickDuration * tick - (currentTime - startTime);
|
||||
|
||||
// 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.
|
||||
//
|
||||
// See https://github.com/netty/netty/issues/356
|
||||
if (isWindows) {
|
||||
sleepTime = (sleepTime / 10) * 10;
|
||||
}
|
||||
|
||||
if (sleepTime <= 0) {
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue