Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,25 @@ public boolean exists() {
}

/**
* Checks if this job has completed its execution, either failing or succeeding. If the job does
* not exist this method returns {@code true}.
* Checks if this job has completed its execution, either failing or succeeding.
*
* <p>If this {@code Job} snapshot is already in {@link JobStatus.State#DONE}, this method returns
* {@code true} without making a network request. Otherwise, it issues a remote status check via
* {@link BigQuery#getJob(JobId, BigQuery.JobOption...)}. Because {@code Job} instances are
* immutable, calling {@code isDone()} does not update this object's status, error, or statistics.
* After {@code isDone()} returns {@code true}, call {@link #reload(JobOption...)} or {@link
* BigQuery#getJob(JobId, BigQuery.JobOption...)} to read the completed job's state.
*
* <p>If the job no longer exists, this method returns {@code true}. For most blocking waits,
* prefer {@link #waitFor(RetryOption...)}.
*
* <p>Example of waiting for a job until it reports that it is done.
*
* <pre>{@code
* while (!job.isDone()) {
* Thread.sleep(1000L);
* }
* Job completedJob = bigquery.getJob(job.getJobId());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

In the Javadoc example, using job.reload() is more idiomatic and self-contained than bigquery.getJob(job.getJobId()) because the job instance already has access to the underlying service and does not require an external bigquery variable to be defined in the example context.

Suggested change
* Job completedJob = bigquery.getJob(job.getJobId());
* Job completedJob = job.reload();
References
  1. Update stale Javadoc comments to reflect new method behavior for improved clarity, rather than removing them.

* }</pre>
*
* @return {@code true} if this job is in {@link JobStatus.State#DONE} state or if it does not
Expand Down
Loading