File tree 3 files changed +16
-1
lines changed
google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2
google-cloud-bigtable-emulator/src/main/java/com/google/cloud/bigtable/emulator/v2
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() {
179
179
}
180
180
181
181
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 ();
183
189
}
184
190
return dataChannel ;
185
191
}
Original file line number Diff line number Diff line change 29
29
import java .util .List ;
30
30
import java .util .logging .Logger ;
31
31
import javax .annotation .Nonnull ;
32
+ import org .threeten .bp .Duration ;
32
33
33
34
/**
34
35
* Settings class to configure an instance of {@link BigtableDataClient}.
@@ -122,6 +123,10 @@ public ManagedChannelBuilder apply(ManagedChannelBuilder input) {
122
123
return input .usePlaintext ();
123
124
}
124
125
})
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
125
130
.build ());
126
131
127
132
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
241
241
return BigtableStubSettings .defaultGrpcTransportProviderBuilder ()
242
242
.setPoolSize (getDefaultChannelPoolSize ())
243
243
.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
244
248
// TODO(weiranf): Set this to true by default once DirectPath goes to public beta
245
249
.setAttemptDirectPath (isDirectPathEnabled ());
246
250
}
You can’t perform that action at this time.
0 commit comments