Send feedback
Class SpannerOptions.SpannerCallContextTimeoutConfigurator
Stay organized with collections
Save and categorize content based on your preferences.
Version 6.24.0 keyboard_arrow_down
public static class SpannerOptions . SpannerCallContextTimeoutConfigurator implements SpannerOptions . CallContextConfigurator
Helper class to configure timeouts for specific Spanner RPCs. The SpannerCallContextTimeoutConfigurator must be set as a value on the Context using the
SpannerOptions#CALL_CONTEXT_CONFIGURATOR_KEY key.
Example usage:
// Create a context with a ExecuteQuery timeout of 10 seconds.
Context context =
Context . current ()
. withValue (
SpannerOptions . CALL_CONTEXT_CONFIGURATOR_KEY ,
SpannerCallContextTimeoutConfigurator . create ()
. withExecuteQueryTimeout ( Duration . ofSeconds ( 10L )));
context . run (
() - > {
try ( ResultSet rs =
client
. singleUse ()
. executeQuery (
Statement . of (
"SELECT SingerId, FirstName, LastName FROM Singers ORDER BY LastName" ))) {
while ( rs . next ()) {
System . out . printf ( "%d %s %s%n" , rs . getLong ( 0 ), rs . getString ( 1 ), rs . getString ( 2 ));
}
} catch ( SpannerException e ) {
if ( e . getErrorCode () == ErrorCode . DEADLINE_EXCEEDED ) {
// Handle timeout.
}
}
}
Inheritance
java.lang.Object >
SpannerOptions.SpannerCallContextTimeoutConfigurator
Static Methods
create()
public static SpannerOptions . SpannerCallContextTimeoutConfigurator create ()
Returns
Methods
<ReqT,RespT>configure(ApiCallContext context, ReqT request, MethodDescriptor<ReqT,RespT> method)
public ApiCallContext <ReqT , RespT>configure ( ApiCallContext context , ReqT request , MethodDescriptor<ReqT , RespT > method )
Parameters
Name Description context ApiCallContext
request ReqT
method io.grpc.MethodDescriptor <ReqT ,RespT >
Returns
getBatchUpdateTimeout()
public Duration getBatchUpdateTimeout ()
Returns
Type Description org.threeten.bp.Duration
getCommitTimeout()
public Duration getCommitTimeout ()
Returns
Type Description org.threeten.bp.Duration
getExecuteQueryTimeout()
public Duration getExecuteQueryTimeout ()
Returns
Type Description org.threeten.bp.Duration
getExecuteUpdateTimeout()
public Duration getExecuteUpdateTimeout ()
Returns
Type Description org.threeten.bp.Duration
getPartitionQueryTimeout()
public Duration getPartitionQueryTimeout ()
Returns
Type Description org.threeten.bp.Duration
getPartitionReadTimeout()
public Duration getPartitionReadTimeout ()
Returns
Type Description org.threeten.bp.Duration
getReadTimeout()
public Duration getReadTimeout ()
Returns
Type Description org.threeten.bp.Duration
getRollbackTimeout()
public Duration getRollbackTimeout ()
Returns
Type Description org.threeten.bp.Duration
withBatchUpdateTimeout(Duration batchUpdateTimeout)
public SpannerOptions . SpannerCallContextTimeoutConfigurator withBatchUpdateTimeout ( Duration batchUpdateTimeout )
Parameter
Name Description batchUpdateTimeout org.threeten.bp.Duration
Returns
withCommitTimeout(Duration commitTimeout)
public SpannerOptions . SpannerCallContextTimeoutConfigurator withCommitTimeout ( Duration commitTimeout )
Parameter
Name Description commitTimeout org.threeten.bp.Duration
Returns
withExecuteQueryTimeout(Duration executeQueryTimeout)
public SpannerOptions . SpannerCallContextTimeoutConfigurator withExecuteQueryTimeout ( Duration executeQueryTimeout )
Parameter
Name Description executeQueryTimeout org.threeten.bp.Duration
Returns
withExecuteUpdateTimeout(Duration executeUpdateTimeout)
public SpannerOptions . SpannerCallContextTimeoutConfigurator withExecuteUpdateTimeout ( Duration executeUpdateTimeout )
Parameter
Name Description executeUpdateTimeout org.threeten.bp.Duration
Returns
withPartitionQueryTimeout(Duration partitionQueryTimeout)
public SpannerOptions . SpannerCallContextTimeoutConfigurator withPartitionQueryTimeout ( Duration partitionQueryTimeout )
Parameter
Name Description partitionQueryTimeout org.threeten.bp.Duration
Returns
withPartitionReadTimeout(Duration partitionReadTimeout)
public SpannerOptions . SpannerCallContextTimeoutConfigurator withPartitionReadTimeout ( Duration partitionReadTimeout )
Parameter
Name Description partitionReadTimeout org.threeten.bp.Duration
Returns
withReadTimeout(Duration readTimeout)
public SpannerOptions . SpannerCallContextTimeoutConfigurator withReadTimeout ( Duration readTimeout )
Parameter
Name Description readTimeout org.threeten.bp.Duration
Returns
withRollbackTimeout(Duration rollbackTimeout)
public SpannerOptions . SpannerCallContextTimeoutConfigurator withRollbackTimeout ( Duration rollbackTimeout )
Parameter
Name Description rollbackTimeout org.threeten.bp.Duration
Returns
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-11-19 UTC.
Need to tell us more?
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-11-19 UTC."],[],[]]