Class Foreman.ForemanResult
java.lang.Object
org.apache.drill.exec.work.foreman.Foreman.ForemanResult
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
- Foreman
Manages the end-state processing for Foreman.
End-state processing is tricky, because even if a query appears to succeed, but
we then encounter a problem during cleanup, we still want to mark the query as
failed. So we have to construct the successful result we would send, and then
clean up before we send that result, possibly changing that result if we encounter
a problem during cleanup. We only send the result when there is nothing left to
do, so it will account for any possible problems.
The idea here is to make close()ing the ForemanResult do the final cleanup and
sending. Closing the result must be the last thing that is done by Foreman.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Expose the current exception (if it exists).void
setCompleted
(UserBitShared.QueryResult.QueryState queryState) Set up the result for a COMPLETED or CANCELED state.void
Set up the result for a FAILED state.void
setForceFailure
(Exception exception) Ignore the current status and force the given failure as current status.
-
Constructor Details
-
ForemanResult
public ForemanResult()
-
-
Method Details
-
setFailed
Set up the result for a FAILED state.Failures that occur during cleanup processing will be added as suppressed exceptions.
- Parameters:
exception
- the exception that led to the FAILED state
-
setForceFailure
Ignore the current status and force the given failure as current status. NOTE: Used only for testing purposes. Shouldn't be used in production. -
getException
Expose the current exception (if it exists). This is useful for secondary reporting to the query profile.- Returns:
- the current Foreman result exception or null.
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable