Class SpannerOptions.SpannerCallContextTimeoutConfigurator (6.83.0)

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
Type Description
SpannerOptions.SpannerCallContextTimeoutConfigurator

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)

Configure a ApiCallContext for a specific RPC call.

Parameters
Name Description
context ApiCallContext
request ReqT
method io.grpc.MethodDescriptor<ReqT,RespT>
Returns
Type Description
ApiCallContext

getBatchUpdateTimeout()

public Duration getBatchUpdateTimeout()

This method is obsolete. Use #getBatchUpdateTimeoutDuration() instead.

Returns
Type Description
org.threeten.bp.Duration

getBatchUpdateTimeoutDuration()

public Duration getBatchUpdateTimeoutDuration()
Returns
Type Description
Duration

getCommitTimeout()

public Duration getCommitTimeout()

This method is obsolete. Use #getCommitTimeoutDuration() instead.

Returns
Type Description
org.threeten.bp.Duration

getCommitTimeoutDuration()

public Duration getCommitTimeoutDuration()
Returns
Type Description
Duration

getExecuteQueryTimeout()

public Duration getExecuteQueryTimeout()

This method is obsolete. Use #getExecuteQueryTimeoutDuration() instead.

Returns
Type Description
org.threeten.bp.Duration

getExecuteQueryTimeoutDuration()

public Duration getExecuteQueryTimeoutDuration()
Returns
Type Description
Duration

getExecuteUpdateTimeout()

public Duration getExecuteUpdateTimeout()

This method is obsolete. Use #getExecuteUpdateTimeoutDuration() instead.

Returns
Type Description
org.threeten.bp.Duration

getExecuteUpdateTimeoutDuration()

public Duration getExecuteUpdateTimeoutDuration()
Returns
Type Description
Duration

getPartitionQueryTimeout()

public Duration getPartitionQueryTimeout()

This method is obsolete. Use #getPartitionQueryTimeoutDuration() instead.

Returns
Type Description
org.threeten.bp.Duration

getPartitionQueryTimeoutDuration()

public Duration getPartitionQueryTimeoutDuration()
Returns
Type Description
Duration

getPartitionReadTimeout()

public Duration getPartitionReadTimeout()

This method is obsolete. Use #getPartitionReadTimeoutDuration() instead.

Returns
Type Description
org.threeten.bp.Duration

getPartitionReadTimeoutDuration()

public Duration getPartitionReadTimeoutDuration()
Returns
Type Description
Duration

getReadTimeout()

public Duration getReadTimeout()

This method is obsolete. Use #getReadTimeoutDuration() instead.

Returns
Type Description
org.threeten.bp.Duration

getReadTimeoutDuration()

public Duration getReadTimeoutDuration()
Returns
Type Description
Duration

getRollbackTimeout()

public Duration getRollbackTimeout()

This method is obsolete. Use #getRollbackTimeoutDuration() instead.

Returns
Type Description
org.threeten.bp.Duration

getRollbackTimeoutDuration()

public Duration getRollbackTimeoutDuration()
Returns
Type Description
Duration

withBatchUpdateTimeout(Duration batchUpdateTimeout)

public SpannerOptions.SpannerCallContextTimeoutConfigurator withBatchUpdateTimeout(Duration batchUpdateTimeout)

This method is obsolete. Use #withBatchUpdateTimeoutDuration(Duration) instead.

Parameter
Name Description
batchUpdateTimeout org.threeten.bp.Duration
Returns
Type Description
SpannerOptions.SpannerCallContextTimeoutConfigurator

withBatchUpdateTimeoutDuration(Duration batchUpdateTimeout)

public SpannerOptions.SpannerCallContextTimeoutConfigurator withBatchUpdateTimeoutDuration(Duration batchUpdateTimeout)
Parameter
Name Description
batchUpdateTimeout Duration
Returns
Type Description
SpannerOptions.SpannerCallContextTimeoutConfigurator

withCommitTimeout(Duration commitTimeout)

public SpannerOptions.SpannerCallContextTimeoutConfigurator withCommitTimeout(Duration commitTimeout)

This method is obsolete. Use #withCommitTimeoutDuration(Duration) instead.

Parameter
Name Description
commitTimeout org.threeten.bp.Duration
Returns
Type Description
SpannerOptions.SpannerCallContextTimeoutConfigurator

withCommitTimeoutDuration(Duration commitTimeout)

public SpannerOptions.SpannerCallContextTimeoutConfigurator withCommitTimeoutDuration(Duration commitTimeout)
Parameter
Name Description
commitTimeout Duration
Returns
Type Description
SpannerOptions.SpannerCallContextTimeoutConfigurator

withExecuteQueryTimeout(Duration executeQueryTimeout)

public SpannerOptions.SpannerCallContextTimeoutConfigurator withExecuteQueryTimeout(Duration executeQueryTimeout)

This method is obsolete. Use #withExecuteQueryTimeoutDuration(Duration) instead.

Parameter
Name Description
executeQueryTimeout org.threeten.bp.Duration
Returns
Type Description
SpannerOptions.SpannerCallContextTimeoutConfigurator

withExecuteQueryTimeoutDuration(Duration executeQueryTimeout)

public SpannerOptions.SpannerCallContextTimeoutConfigurator withExecuteQueryTimeoutDuration(Duration executeQueryTimeout)
Parameter
Name Description
executeQueryTimeout Duration
Returns
Type Description
SpannerOptions.SpannerCallContextTimeoutConfigurator

withExecuteUpdateTimeout(Duration executeUpdateTimeout)

public SpannerOptions.SpannerCallContextTimeoutConfigurator withExecuteUpdateTimeout(Duration executeUpdateTimeout)

This method is obsolete. Use #withExecuteUpdateTimeoutDuration(Duration) instead.

Parameter
Name Description
executeUpdateTimeout org.threeten.bp.Duration
Returns
Type Description
SpannerOptions.SpannerCallContextTimeoutConfigurator

withExecuteUpdateTimeoutDuration(Duration executeUpdateTimeout)

public SpannerOptions.SpannerCallContextTimeoutConfigurator withExecuteUpdateTimeoutDuration(Duration executeUpdateTimeout)
Parameter
Name Description
executeUpdateTimeout Duration
Returns
Type Description
SpannerOptions.SpannerCallContextTimeoutConfigurator

withPartitionQueryTimeout(Duration partitionQueryTimeout)

public SpannerOptions.SpannerCallContextTimeoutConfigurator withPartitionQueryTimeout(Duration partitionQueryTimeout)

This method is obsolete. Use #withPartitionQueryTimeoutDuration(Duration) instead.

Parameter
Name Description
partitionQueryTimeout org.threeten.bp.Duration
Returns
Type Description
SpannerOptions.SpannerCallContextTimeoutConfigurator

withPartitionQueryTimeoutDuration(Duration partitionQueryTimeout)

public SpannerOptions.SpannerCallContextTimeoutConfigurator withPartitionQueryTimeoutDuration(Duration partitionQueryTimeout)
Parameter
Name Description
partitionQueryTimeout Duration
Returns
Type Description
SpannerOptions.SpannerCallContextTimeoutConfigurator

withPartitionReadTimeout(Duration partitionReadTimeout)

public SpannerOptions.SpannerCallContextTimeoutConfigurator withPartitionReadTimeout(Duration partitionReadTimeout)

This method is obsolete. Use #withPartitionReadTimeoutDuration(Duration) instead.

Parameter
Name Description
partitionReadTimeout org.threeten.bp.Duration
Returns
Type Description
SpannerOptions.SpannerCallContextTimeoutConfigurator

withPartitionReadTimeoutDuration(Duration partitionReadTimeout)

public SpannerOptions.SpannerCallContextTimeoutConfigurator withPartitionReadTimeoutDuration(Duration partitionReadTimeout)
Parameter
Name Description
partitionReadTimeout Duration
Returns
Type Description
SpannerOptions.SpannerCallContextTimeoutConfigurator

withReadTimeout(Duration readTimeout)

public SpannerOptions.SpannerCallContextTimeoutConfigurator withReadTimeout(Duration readTimeout)

This method is obsolete. Use #withReadTimeoutDuration(Duration) instead.

Parameter
Name Description
readTimeout org.threeten.bp.Duration
Returns
Type Description
SpannerOptions.SpannerCallContextTimeoutConfigurator

withReadTimeoutDuration(Duration readTimeout)

public SpannerOptions.SpannerCallContextTimeoutConfigurator withReadTimeoutDuration(Duration readTimeout)
Parameter
Name Description
readTimeout Duration
Returns
Type Description
SpannerOptions.SpannerCallContextTimeoutConfigurator

withRollbackTimeout(Duration rollbackTimeout)

public SpannerOptions.SpannerCallContextTimeoutConfigurator withRollbackTimeout(Duration rollbackTimeout)

This method is obsolete. Use #withRollbackTimeoutDuration(Duration) instead.

Parameter
Name Description
rollbackTimeout org.threeten.bp.Duration
Returns
Type Description
SpannerOptions.SpannerCallContextTimeoutConfigurator

withRollbackTimeoutDuration(Duration rollbackTimeout)

public SpannerOptions.SpannerCallContextTimeoutConfigurator withRollbackTimeoutDuration(Duration rollbackTimeout)
Parameter
Name Description
rollbackTimeout Duration
Returns
Type Description
SpannerOptions.SpannerCallContextTimeoutConfigurator