/** * Calling this method with a non-<code>null</code> error message implies that the request's status is * {@link OperationRequestStatus#FAILURE}. The inverse is <i>not</i> true - that is, if you set the error message to * <code>null</code>, the status is left as-is; it will not assume that a <code>null</code> error message means the * status is successful. * * @param errorMessage */ public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; if (this.errorMessage != null) { setStatus(OperationRequestStatus.FAILURE); } }
public void operationTimedOut(String jobId, long invocationTime, long timeoutTime) { LOG.debug("Operation invocation [" + jobId + "] failed due to a timeout " + getFromStartToEndTimestampString(invocationTime, timeoutTime)); try { Subject superuser = LookupUtil.getSubjectManager().getOverlord(); OperationManagerLocal operationManager = LookupUtil.getOperationManager(); OperationHistory history = operationManager.getOperationHistoryByJobId(superuser, jobId); if (history.getStatus() == OperationRequestStatus.INPROGRESS) { history.setErrorMessage("Timed out"); history.setStatus(OperationRequestStatus.FAILURE); operationManager.updateOperationHistory(superuser, history); operationManager.checkForCompletedGroupOperation(history.getId()); } else { // if the operation was not in progress, the server side probably already timed it out LOG.warn("Was told to timeout an operation history but it was not in progress: " + "job-id=[" + jobId + "], op-history=[" + history + "]"); } } catch (Exception e) { LOG.error("Failed to update history from timed out operation, jobId=[" + jobId + "]. Cause: " + e, e); } }
existingHistoryItem.setStatus(history.getStatus()); existingHistoryItem.setErrorMessage(history.getErrorMessage()); if (existingHistoryItem.getStartedTime() == 0) {