Code example for Predicate

Methods: apply

    * @return result of the job's execution 
    * @throws ExecutionException 
    *            if the job contained an error 
   public <T> T apply(AsyncCreateResponse job) {
      boolean completed = jobComplete.apply(job.getJobId());
      logger.trace("<< job(%s) complete(%s)", job, completed);
      AsyncJob<T> jobWithResult = client.getAsyncJobApi().<T> getAsyncJob(job.getJobId());
      checkState(completed, "job %s failed to complete in time %s", job.getJobId(), jobWithResult);
      if (jobWithResult.getError() != null)
         throw new UncheckedExecutionException(String.format("job %s failed with exception %s", job.getJobId(),
               jobWithResult.getError().toString())) {
      return jobWithResult.getResult();