use of org.apache.hyracks.control.cc.job.IJobStatusConditionVariable in project asterixdb by apache.
the class WaitForJobCompletionWork method doRun.
@Override
protected void doRun() throws Exception {
IJobManager jobManager = ccs.getJobManager();
final IJobStatusConditionVariable cRunningVar = jobManager.get(jobId);
if (cRunningVar != null) {
ccs.getExecutor().execute(new Runnable() {
@Override
public void run() {
try {
cRunningVar.waitForCompletion();
callback.setValue(null);
} catch (Exception e) {
callback.setException(e);
}
}
});
} else {
final List<Exception> exceptions = jobManager.getExceptionHistory(jobId);
ccs.getExecutor().execute(new Runnable() {
@Override
public void run() {
callback.setValue(null);
if (exceptions != null && !exceptions.isEmpty()) {
/**
* only report the first exception because IResultCallback will only throw one exception
* anyway
*/
callback.setException(exceptions.get(0));
}
}
});
}
}
Aggregations