} else if (state == TajoProtos.QueryState.QUERY_FAILED || state == TajoProtos.QueryState.QUERY_ERROR) {
appStatus = FinalApplicationStatus.FAILED;
} else if (state == TajoProtos.QueryState.QUERY_ERROR) {
appStatus = FinalApplicationStatus.FAILED;
}
FinishApplicationMasterRequest request = recordFactory
.newRecordInstance(FinishApplicationMasterRequest.class);
request.setAppAttemptId(ApplicationIdUtils.createApplicationAttemptId(queryId));
request.setFinishApplicationStatus(appStatus);
request.setDiagnostics("QueryMaster shutdown by TajoMaster.");
rmClient.finishApplicationMaster(request);
} catch (Exception e) {
LOG.error(e.getMessage(), e);
}
}