use of org.apache.drill.common.DeferredException in project drill by apache.
the class BaseRootExec method close.
@Override
public void close() throws Exception {
// We want to account for the time spent waiting here as Wait time in the operator profile
try {
stats.startProcessing();
stats.startWait();
fragmentContext.waitForSendComplete();
} finally {
stats.stopWait();
stats.stopProcessing();
}
// close all operators.
if (operators != null) {
final DeferredException df = new DeferredException(new Supplier<Exception>() {
@Override
public Exception get() {
return new RuntimeException("Error closing operators");
}
});
for (final CloseableRecordBatch crb : operators) {
df.suppressingClose(crb);
if (logger.isDebugEnabled()) {
logger.debug(String.format("closed operator %d", System.identityHashCode(crb)));
}
}
try {
df.close();
} catch (Exception e) {
fragmentContext.fail(e);
}
}
}
Aggregations