com.google.cloud.bigtable.grpc.io
Class Watchdog
- java.lang.Object
-
- com.google.cloud.bigtable.grpc.io.Watchdog
-
- All Implemented Interfaces:
- Runnable
@InternalApi public class Watchdog extends Object implements Runnable
Prevents the streams from hanging indefinitely. This middleware garbage collects idle streams in case the user forgot to close a ClientCall or if a connection is reset and GRPC does not get notified.Periodically this class checks two thresholds:
- waitingTimeout: the amount of time to wait for a response (after the caller signaled demand) before forcefully closing the stream.
- idleTimeout: the amount of time to wait before assuming that the caller forgot to close the stream and forcefully closing the stream. This is measured from the last time the caller had no outstanding demand.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static class
Watchdog.State
static class
Watchdog.StreamWaitTimeoutException
Marker exception to replace cancelled status with aborted to allow retries.
-
Constructor Summary
Constructors Constructor and Description Watchdog(com.google.api.client.util.Clock clock, long waitTimeoutMs)
Watchdog(com.google.api.client.util.Clock clock, long waitTimeoutMs, long idleTimeoutMs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
run()
void
start(ScheduledExecutorService executor)
void
stop()
<ReqT,RespT>
io.grpc.ClientCall<ReqT,RespT>watch(io.grpc.ClientCall<ReqT,RespT> innerCall)
-
-
-
Constructor Detail
-
Watchdog
public Watchdog(com.google.api.client.util.Clock clock, long waitTimeoutMs)
-
Watchdog
public Watchdog(com.google.api.client.util.Clock clock, long waitTimeoutMs, long idleTimeoutMs)
-
-
Method Detail
-
watch
public <ReqT,RespT> io.grpc.ClientCall<ReqT,RespT> watch(io.grpc.ClientCall<ReqT,RespT> innerCall)
-
start
public void start(ScheduledExecutorService executor)
-
stop
public void stop()
-
-