Skip to content

Commit

Permalink
Always pass options.clock() to RetryHelper.runWithRetries
Browse files Browse the repository at this point in the history
  • Loading branch information
mziccard committed May 18, 2016
1 parent d1ab2bd commit 497ccbd
Show file tree
Hide file tree
Showing 11 changed files with 124 additions and 125 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public Dataset create(DatasetInfo dataset, DatasetOption... options) {
public com.google.api.services.bigquery.model.Dataset call() {
return bigQueryRpc.create(datasetPb, optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER));
}, options().retryParams(), EXCEPTION_HANDLER, options().clock()));
} catch (RetryHelper.RetryHelperException e) {
throw BigQueryException.translateAndThrow(e);
}
Expand All @@ -182,7 +182,7 @@ public Table create(TableInfo table, TableOption... options) {
public com.google.api.services.bigquery.model.Table call() {
return bigQueryRpc.create(tablePb, optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER));
}, options().retryParams(), EXCEPTION_HANDLER, options().clock()));
} catch (RetryHelper.RetryHelperException e) {
throw BigQueryException.translateAndThrow(e);
}
Expand All @@ -200,7 +200,7 @@ public Job create(JobInfo job, JobOption... options) {
public com.google.api.services.bigquery.model.Job call() {
return bigQueryRpc.create(jobPb, optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER));
}, options().retryParams(), EXCEPTION_HANDLER, options().clock()));
} catch (RetryHelper.RetryHelperException e) {
throw BigQueryException.translateAndThrow(e);
}
Expand All @@ -221,7 +221,7 @@ public Dataset getDataset(final DatasetId datasetId, DatasetOption... options) {
public com.google.api.services.bigquery.model.Dataset call() {
return bigQueryRpc.getDataset(datasetId.dataset(), optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER);
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
return answer == null ? null : Dataset.fromPb(this, answer);
} catch (RetryHelper.RetryHelperException e) {
throw BigQueryException.translateAndThrow(e);
Expand All @@ -244,7 +244,7 @@ private static Page<Dataset> listDatasets(final BigQueryOptions serviceOptions,
Iterable<com.google.api.services.bigquery.model.Dataset>> call() {
return serviceOptions.rpc().listDatasets(optionsMap);
}
}, serviceOptions.retryParams(), EXCEPTION_HANDLER);
}, serviceOptions.retryParams(), EXCEPTION_HANDLER, serviceOptions.clock());
String cursor = result.x();
return new PageImpl<>(new DatasetPageFetcher(serviceOptions, cursor, optionsMap), cursor,
Iterables.transform(result.y(),
Expand Down Expand Up @@ -273,7 +273,7 @@ public boolean delete(final DatasetId datasetId, DatasetDeleteOption... options)
public Boolean call() {
return bigQueryRpc.deleteDataset(datasetId.dataset(), optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER);
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
} catch (RetryHelper.RetryHelperException e) {
throw BigQueryException.translateAndThrow(e);
}
Expand All @@ -292,7 +292,7 @@ public boolean delete(final TableId tableId) {
public Boolean call() {
return bigQueryRpc.deleteTable(tableId.dataset(), tableId.table());
}
}, options().retryParams(), EXCEPTION_HANDLER);
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
} catch (RetryHelper.RetryHelperException e) {
throw BigQueryException.translateAndThrow(e);
}
Expand All @@ -310,7 +310,7 @@ public Dataset update(DatasetInfo dataset, DatasetOption... options) {
public com.google.api.services.bigquery.model.Dataset call() {
return bigQueryRpc.patch(datasetPb, optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER));
}, options().retryParams(), EXCEPTION_HANDLER, options().clock()));
} catch (RetryHelper.RetryHelperException e) {
throw BigQueryException.translateAndThrow(e);
}
Expand All @@ -328,7 +328,7 @@ public Table update(TableInfo table, TableOption... options) {
public com.google.api.services.bigquery.model.Table call() {
return bigQueryRpc.patch(tablePb, optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER));
}, options().retryParams(), EXCEPTION_HANDLER, options().clock()));
} catch (RetryHelper.RetryHelperException e) {
throw BigQueryException.translateAndThrow(e);
}
Expand All @@ -349,7 +349,7 @@ public Table getTable(final TableId tableId, TableOption... options) {
public com.google.api.services.bigquery.model.Table call() {
return bigQueryRpc.getTable(tableId.dataset(), tableId.table(), optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER);
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
return answer == null ? null : Table.fromPb(this, answer);
} catch (RetryHelper.RetryHelperException e) {
throw BigQueryException.translateAndThrow(e);
Expand Down Expand Up @@ -377,7 +377,7 @@ private static Page<Table> listTables(final String datasetId, final BigQueryOpti
call() {
return serviceOptions.rpc().listTables(datasetId, optionsMap);
}
}, serviceOptions.retryParams(), EXCEPTION_HANDLER);
}, serviceOptions.retryParams(), EXCEPTION_HANDLER, serviceOptions.clock());
String cursor = result.x();
Iterable<Table> tables = Iterables.transform(result.y(),
new Function<com.google.api.services.bigquery.model.Table, Table>() {
Expand Down Expand Up @@ -432,7 +432,7 @@ public BigQueryRpc.Tuple<String, Iterable<TableRow>> call() {
return serviceOptions.rpc()
.listTableData(tableId.dataset(), tableId.table(), optionsMap);
}
}, serviceOptions.retryParams(), EXCEPTION_HANDLER);
}, serviceOptions.retryParams(), EXCEPTION_HANDLER, serviceOptions.clock());
String cursor = result.x();
return new PageImpl<>(new TableDataPageFetcher(tableId, serviceOptions, cursor, optionsMap),
cursor, transformTableData(result.y()));
Expand Down Expand Up @@ -467,7 +467,7 @@ public Job getJob(final JobId jobId, JobOption... options) {
public com.google.api.services.bigquery.model.Job call() {
return bigQueryRpc.getJob(jobId.job(), optionsMap);
}
}, options().retryParams(), EXCEPTION_HANDLER);
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
return answer == null ? null : Job.fromPb(this, answer);
} catch (RetryHelper.RetryHelperException e) {
throw BigQueryException.translateAndThrow(e);
Expand All @@ -489,7 +489,7 @@ private static Page<Job> listJobs(final BigQueryOptions serviceOptions,
call() {
return serviceOptions.rpc().listJobs(optionsMap);
}
}, serviceOptions.retryParams(), EXCEPTION_HANDLER);
}, serviceOptions.retryParams(), EXCEPTION_HANDLER, serviceOptions.clock());
String cursor = result.x();
Iterable<Job> jobs = Iterables.transform(result.y(),
new Function<com.google.api.services.bigquery.model.Job, Job>() {
Expand All @@ -514,7 +514,7 @@ public boolean cancel(final JobId jobId) {
public Boolean call() {
return bigQueryRpc.cancel(jobId.job());
}
}, options().retryParams(), EXCEPTION_HANDLER);
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
} catch (RetryHelper.RetryHelperException e) {
throw BigQueryException.translateAndThrow(e);
}
Expand All @@ -529,7 +529,7 @@ public QueryResponse query(final QueryRequest request) {
public com.google.api.services.bigquery.model.QueryResponse call() {
return bigQueryRpc.query(request.setProjectId(options().projectId()).toPb());
}
}, options().retryParams(), EXCEPTION_HANDLER);
}, options().retryParams(), EXCEPTION_HANDLER, options().clock());
QueryResponse.Builder builder = QueryResponse.builder();
JobId completeJobId = JobId.fromPb(results.getJobReference());
builder.jobId(completeJobId);
Expand Down Expand Up @@ -574,7 +574,7 @@ private static QueryResponse getQueryResults(final JobId jobId,
public GetQueryResultsResponse call() {
return serviceOptions.rpc().getQueryResults(jobId.job(), optionsMap);
}
}, serviceOptions.retryParams(), EXCEPTION_HANDLER);
}, serviceOptions.retryParams(), EXCEPTION_HANDLER, serviceOptions.clock());
QueryResponse.Builder builder = QueryResponse.builder();
JobId completeJobId = JobId.fromPb(results.getJobReference());
builder.jobId(completeJobId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected void flushBuffer(final int length, final boolean last) {
public void run() {
options().rpc().write(uploadId(), buffer(), 0, position(), length, last);
}
}), options().retryParams(), BigQueryImpl.EXCEPTION_HANDLER);
}), options().retryParams(), BigQueryImpl.EXCEPTION_HANDLER, options().clock());
} catch (RetryHelper.RetryHelperException e) {
throw BigQueryException.translateAndThrow(e);
}
Expand Down
Loading

0 comments on commit 497ccbd

Please sign in to comment.