public boolean isTimedOut(long current) { if (operationTimeout == 0) { return false; } if (operationTimeout > 0) { // check only when it's in terminal state return state.isTerminal() && lastAccessTime + operationTimeout <= current; } return lastAccessTime + -operationTimeout <= current; }
public boolean isDone() { return state.isTerminal(); }
protected void onNewState(OperationState state, OperationState prevState) { switch(state) { case RUNNING: markOperationStartTime(); break; case ERROR: case FINISHED: case CANCELED: markOperationCompletedTime(); break; } if (state.isTerminal()) { // Unlock the execution thread as operation is already terminated. opTerminateMonitorLatch.countDown(); } }
/** * Cancel the running operation unless it is already in a terminal state * @param opHandle operation handle * @param errMsg error message * @throws HiveSQLException */ public void cancelOperation(OperationHandle opHandle, String errMsg) throws HiveSQLException { Operation operation = getOperation(opHandle); OperationState opState = operation.getStatus().getState(); if (opState.isTerminal()) { // Cancel should be a no-op in either cases LOG.debug(opHandle + ": Operation is already aborted in state - " + opState); } else { LOG.debug(opHandle + ": Attempting to cancel from state - " + opState); OperationState operationState = OperationState.CANCELED; operationState.setErrorMessage(errMsg); operation.cancel(operationState); if (operation instanceof SQLOperation) { removeSafeQueryInfo(opHandle); } } }
if ((timeoutExecutor != null) && (state != OperationState.TIMEDOUT) && (state.isTerminal())) { timeoutExecutor.shutdownNow();
OperationState opState = getStatus().getState(); if (opState.isTerminal()) { LOG.info("Not running the query. Operation is already in terminal state: " + opState + ", perhaps cancelled due to query timeout or by another thread.");
public boolean isTimedOut(long current) { if (operationTimeout == 0) { return false; } if (operationTimeout > 0) { // check only when it's in terminal state return state.isTerminal() && lastAccessTime + operationTimeout <= current; } return lastAccessTime + -operationTimeout <= current; }
public boolean isTimedOut(long current) { if (operationTimeout == 0) { return false; } if (operationTimeout > 0) { // check only when it's in terminal state return state.isTerminal() && lastAccessTime + operationTimeout <= current; } return lastAccessTime + -operationTimeout <= current; }
public boolean isTimedOut(long current) { if (operationTimeout == 0) { return false; } if (operationTimeout > 0) { // check only when it's in terminal state return state.isTerminal() && lastAccessTime + operationTimeout <= current; } return lastAccessTime + -operationTimeout <= current; }
public boolean isTimedOut(long current) { if (operationTimeout == 0) { return false; } if (operationTimeout > 0) { // check only when it's in terminal state return state.isTerminal() && lastAccessTime + operationTimeout <= current; } return lastAccessTime + -operationTimeout <= current; }
public boolean isTimedOut(long current) { if (operationTimeout == 0) { return false; } if (operationTimeout > 0) { // check only when it's in terminal state return state.isTerminal() && lastAccessTime + operationTimeout <= current; } return lastAccessTime + -operationTimeout <= current; }
public boolean isDone() { return state.isTerminal(); }
/** * Cancel the running operation unless it is already in a terminal state * @param opHandle operation handle * @param errMsg error message * @throws HiveSQLException */ public void cancelOperation(OperationHandle opHandle, String errMsg) throws HiveSQLException { Operation operation = getOperation(opHandle); OperationState opState = operation.getStatus().getState(); if (opState.isTerminal()) { // Cancel should be a no-op in either cases LOG.debug(opHandle + ": Operation is already aborted in state - " + opState); } else { LOG.debug(opHandle + ": Attempting to cancel from state - " + opState); OperationState operationState = OperationState.CANCELED; operationState.setErrorMessage(errMsg); operation.cancel(operationState); if (operation instanceof SQLOperation) { removeSafeQueryInfo(opHandle); } } }
if ((timeoutExecutor != null) && (state != OperationState.TIMEDOUT) && (state.isTerminal())) { timeoutExecutor.shutdownNow();
OperationState opState = getStatus().getState(); if (opState.isTerminal()) { LOG.info("Not running the query. Operation is already in terminal state: " + opState + ", perhaps cancelled due to query timeout or by another thread.");