File tree Expand file tree Collapse file tree 3 files changed +16
-1
lines changed
google-cloud-bigtable-emulator/src/main/java/com/google/cloud/bigtable/emulator/v2
google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2 Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -179,7 +179,13 @@ public synchronized ManagedChannel getDataChannel() {
179179 }
180180
181181 if (dataChannel == null ) {
182- dataChannel = newChannelBuilder (port ).maxInboundMessageSize (256 * 1024 * 1024 ).build ();
182+ dataChannel =
183+ newChannelBuilder (port )
184+ .maxInboundMessageSize (256 * 1024 * 1024 )
185+ .keepAliveTimeout (10 , TimeUnit .SECONDS )
186+ .keepAliveTime (10 , TimeUnit .SECONDS )
187+ .keepAliveWithoutCalls (true )
188+ .build ();
183189 }
184190 return dataChannel ;
185191 }
Original file line number Diff line number Diff line change 2929import java .util .List ;
3030import java .util .logging .Logger ;
3131import javax .annotation .Nonnull ;
32+ import org .threeten .bp .Duration ;
3233
3334/**
3435 * Settings class to configure an instance of {@link BigtableDataClient}.
@@ -122,6 +123,10 @@ public ManagedChannelBuilder apply(ManagedChannelBuilder input) {
122123 return input .usePlaintext ();
123124 }
124125 })
126+ .setKeepAliveTime (Duration .ofSeconds (10 )) // sends ping in this interval
127+ .setKeepAliveTimeout (
128+ Duration .ofSeconds (10 )) // wait this long before considering the connection dead
129+ .setKeepAliveWithoutCalls (true ) // sends ping without active streams
125130 .build ());
126131
127132 LOGGER .info ("Connecting to the Bigtable emulator at " + hostname + ":" + port );
Original file line number Diff line number Diff line change @@ -241,6 +241,10 @@ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProvi
241241 return BigtableStubSettings .defaultGrpcTransportProviderBuilder ()
242242 .setPoolSize (getDefaultChannelPoolSize ())
243243 .setMaxInboundMessageSize (MAX_MESSAGE_SIZE )
244+ .setKeepAliveTime (Duration .ofSeconds (10 )) // sends ping in this interval
245+ .setKeepAliveTimeout (
246+ Duration .ofSeconds (10 )) // wait this long before considering the connection dead
247+ .setKeepAliveWithoutCalls (true ) // sends ping without active streams
244248 // TODO(weiranf): Set this to true by default once DirectPath goes to public beta
245249 .setAttemptDirectPath (isDirectPathEnabled ());
246250 }
You can’t perform that action at this time.
0 commit comments