selector.setJobIds(new long[] {jobId});
// Poll for job status until it's finished.
System.out.println("Retrieving job status...");
SimpleMutateJob jobStatusResponse = null;
BasicJobStatus status = null;
for (int i = 0; i < RETRIES_COUNT; i++) {
Job[] jobs = mutateJobService.get(selector);
jobStatusResponse = (SimpleMutateJob) jobs[0];
status = jobStatusResponse.getStatus();
if (status == BasicJobStatus.COMPLETED || status == BasicJobStatus.FAILED) {
break;
}
System.out.printf("[%d] Current status is '%s', waiting %d seconds to retry...\n", i,
status.toString(), RETRY_INTERVAL);
Thread.sleep(RETRY_INTERVAL * 1000);
}
// Handle unsuccessful results.
if (status == BasicJobStatus.FAILED) {