Search in sources :

Example 1 with DeferredException

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);
        }
    }
}
Also used : CloseableRecordBatch(org.apache.drill.exec.record.CloseableRecordBatch) DeferredException(org.apache.drill.common.DeferredException) OutOfMemoryException(org.apache.drill.exec.exception.OutOfMemoryException) DeferredException(org.apache.drill.common.DeferredException)

Aggregations

DeferredException (org.apache.drill.common.DeferredException)1 OutOfMemoryException (org.apache.drill.exec.exception.OutOfMemoryException)1 CloseableRecordBatch (org.apache.drill.exec.record.CloseableRecordBatch)1