Package io.grpc.internal
Class KeepAliveManager
java.lang.Object
io.grpc.internal.KeepAliveManager
Manages keepalive pings.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classDefault client sideKeepAliveManager.KeepAlivePinger.static interfaceprivate static enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanprivate final KeepAliveManager.KeepAlivePingerprivate final longprivate final longprivate static final longprivate static final longprivate ScheduledFuture<?> private final ScheduledExecutorServiceprivate final Runnableprivate final Runnableprivate ScheduledFuture<?> private KeepAliveManager.Stateprivate final com.google.common.base.Stopwatch -
Constructor Summary
ConstructorsConstructorDescriptionKeepAliveManager(KeepAliveManager.KeepAlivePinger keepAlivePinger, ScheduledExecutorService scheduler, long keepAliveTimeInNanos, long keepAliveTimeoutInNanos, boolean keepAliveDuringTransportIdle) Creates a KeepAliverManager.KeepAliveManager(KeepAliveManager.KeepAlivePinger keepAlivePinger, ScheduledExecutorService scheduler, com.google.common.base.Stopwatch stopwatch, long keepAliveTimeInNanos, long keepAliveTimeoutInNanos, boolean keepAliveDuringTransportIdle) -
Method Summary
Modifier and TypeMethodDescriptionstatic longclampKeepAliveTimeInNanos(long keepAliveTimeInNanos) Bumps keepalive time to 10 seconds if the specified value was smaller than that.static longclampKeepAliveTimeoutInNanos(long keepAliveTimeoutInNanos) Bumps keepalive timeout to 10 milliseconds if the specified value was smaller than that.voidTransport has received some data so that we can delay sending keepalives.voidTransport has active streams.voidTransport has finished all streams.voidStart keepalive monitoring.voidTransport is being terminated.
-
Field Details
-
MIN_KEEPALIVE_TIME_NANOS
private static final long MIN_KEEPALIVE_TIME_NANOS -
MIN_KEEPALIVE_TIMEOUT_NANOS
private static final long MIN_KEEPALIVE_TIMEOUT_NANOS -
scheduler
-
stopwatch
private final com.google.common.base.Stopwatch stopwatch -
keepAlivePinger
-
keepAliveDuringTransportIdle
private final boolean keepAliveDuringTransportIdle -
state
-
shutdownFuture
-
pingFuture
-
shutdown
-
sendPing
-
keepAliveTimeInNanos
private final long keepAliveTimeInNanos -
keepAliveTimeoutInNanos
private final long keepAliveTimeoutInNanos
-
-
Constructor Details
-
KeepAliveManager
public KeepAliveManager(KeepAliveManager.KeepAlivePinger keepAlivePinger, ScheduledExecutorService scheduler, long keepAliveTimeInNanos, long keepAliveTimeoutInNanos, boolean keepAliveDuringTransportIdle) Creates a KeepAliverManager. -
KeepAliveManager
KeepAliveManager(KeepAliveManager.KeepAlivePinger keepAlivePinger, ScheduledExecutorService scheduler, com.google.common.base.Stopwatch stopwatch, long keepAliveTimeInNanos, long keepAliveTimeoutInNanos, boolean keepAliveDuringTransportIdle)
-
-
Method Details
-
onTransportStarted
public void onTransportStarted()Start keepalive monitoring. -
onDataReceived
public void onDataReceived()Transport has received some data so that we can delay sending keepalives. -
onTransportActive
public void onTransportActive()Transport has active streams. Start sending keepalives if necessary. -
onTransportIdle
public void onTransportIdle()Transport has finished all streams. -
onTransportTermination
public void onTransportTermination()Transport is being terminated. We no longer need to do keepalives. -
clampKeepAliveTimeInNanos
public static long clampKeepAliveTimeInNanos(long keepAliveTimeInNanos) Bumps keepalive time to 10 seconds if the specified value was smaller than that. -
clampKeepAliveTimeoutInNanos
public static long clampKeepAliveTimeoutInNanos(long keepAliveTimeoutInNanos) Bumps keepalive timeout to 10 milliseconds if the specified value was smaller than that.
-