From 1594ebbc122b4b87a2b044968ca8e8fef595263f Mon Sep 17 00:00:00 2001 From: ZHANG Dapeng Date: Fri, 9 Jun 2017 14:28:32 -0700 Subject: [PATCH] core: scheduler.schedule() can be used normally Since netty 4.1.11-final, netty/netty#6627 has been fixed. --- core/src/main/java/io/grpc/internal/KeepAliveManager.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/io/grpc/internal/KeepAliveManager.java b/core/src/main/java/io/grpc/internal/KeepAliveManager.java index 2322114fce..a5eb086b35 100644 --- a/core/src/main/java/io/grpc/internal/KeepAliveManager.java +++ b/core/src/main/java/io/grpc/internal/KeepAliveManager.java @@ -73,8 +73,7 @@ public class KeepAliveManager { // We have received some data. Reschedule the ping with the new time. pingFuture = scheduler.schedule( sendPing, - // normalized as some Netty executor service does not accept a negative delay - Math.max(nextKeepaliveTime - ticker.read(), 0L), + nextKeepaliveTime - ticker.read(), TimeUnit.NANOSECONDS); state = State.PING_SCHEDULED; } @@ -186,8 +185,7 @@ public class KeepAliveManager { state = State.PING_SCHEDULED; pingFuture = scheduler.schedule( sendPing, - // normalized as some Netty executor service does not accept a negative delay - Math.max(nextKeepaliveTime - ticker.read(), 0L), + nextKeepaliveTime - ticker.read(), TimeUnit.NANOSECONDS); } else if (state == State.IDLE_AND_PING_SENT) { state = State.PING_SENT;