/** * Stops query execution if a user requested cancel. */ public void checkCancelled() throws QueryCancelledException { if (clo == CANCELLED) throw new QueryCancelledException(); } }
/** * Sets a cancel closure. * * @param clo Clo. */ public void set(Runnable clo) throws QueryCancelledException { assert clo != null; while(true) { Runnable tmp = this.clo; if (tmp == CANCELLED) throw new QueryCancelledException(); if (STATE_UPDATER.compareAndSet(this, tmp, clo)) return; } }
/** * @return An simple iterator. */ protected Iterator<T> iter() { if (!STATE_UPDATER.compareAndSet(this, IDLE, EXECUTION)) throw new IgniteException("Iterator is already fetched or query was cancelled."); iter = iterExec.iterator(); if (!STATE_UPDATER.compareAndSet(this, EXECUTION, RESULT_READY)) { // Handle race with cancel and make sure the iterator resources are freed correctly. closeIter(); throw new CacheException(new QueryCancelledException()); } assert iter != null; return iter; }
/** * @param r Query run. * @param nodeId Failed node ID. * @param msg Error message. */ private void fail(ReduceQueryRun r, UUID nodeId, String msg, byte failCode) { if (r != null) { CacheException e = new CacheException("Failed to execute map query on remote node [nodeId=" + nodeId + ", errMsg=" + msg + ']'); if (failCode == GridQueryFailResponse.CANCELLED_BY_ORIGINATOR) e.addSuppressed(new QueryCancelledException()); r.setStateOnException(nodeId, e); } }
throw new QueryCancelledException();
throw new QueryCancelledException(); else if (e instanceof IgniteSQLException) { BatchUpdateException batchCause = X.cause(e, BatchUpdateException.class);
unregisterRequest(req.requestId()); return exceptionToResult(new QueryCancelledException());
return exceptionToResult(new QueryCancelledException()); else return new JdbcResponse(IgniteQueryErrorCode.UNKNOWN, "Server error: " + e);
sendError(node, req.queryRequestId(), new QueryCancelledException()); sendError(node, req.queryRequestId(), new CacheException("No query result found for request: " + req)); else if (qr.cancelled()) sendError(node, req.queryRequestId(), new QueryCancelledException()); else { Boolean dataPageScanEnabled = isDataPageScanEnabled(req.getFlags());
return exceptionToResult(new QueryCancelledException()); else return exceptionToResult(e);
return exceptionToResult(new QueryCancelledException()); else return exceptionToResult(e);
throw new QueryCancelledException(); qr.result(qryIdx).close(); throw new QueryCancelledException();
throw new QueryCancelledException(); // Throw correct exception. if (wasCancelled((CacheException)e)) resEx = new CacheException("Failed to run reduce query locally.", new QueryCancelledException()); else resEx = (CacheException)e;
/** * Stops query execution if a user requested cancel. */ public void checkCancelled() throws QueryCancelledException { if (clo == CANCELLED) throw new QueryCancelledException(); } }
/** * Sets a cancel closure. * * @param clo Clo. */ public void set(Runnable clo) throws QueryCancelledException { assert clo != null; while(true) { Runnable tmp = this.clo; if (tmp == CANCELLED) throw new QueryCancelledException(); if (STATE_UPDATER.compareAndSet(this, tmp, clo)) return; } }
/** {@inheritDoc} */ @Override public Iterator<T> iterator() { if (!STATE_UPDATER.compareAndSet(this, IDLE, EXECUTION)) throw new IgniteException("Iterator is already fetched or query was cancelled."); iter = iterExec.iterator(); if (!STATE_UPDATER.compareAndSet(this, EXECUTION, RESULT_READY)) { // Handle race with cancel and make sure the iterator resources are freed correctly. closeIter(); throw new CacheException(new QueryCancelledException()); } assert iter != null; return iter; }
/** * @param r Query run. * @param nodeId Failed node ID. * @param msg Error message. */ private void fail(ReduceQueryRun r, UUID nodeId, String msg, byte failCode) { if (r != null) { CacheException e = new CacheException("Failed to execute map query on remote node [nodeId=" + nodeId + ", errMsg=" + msg + ']'); if (failCode == GridQueryFailResponse.CANCELLED_BY_ORIGINATOR) e.addSuppressed(new QueryCancelledException()); r.setStateOnException(nodeId, e); } }
sendError(node, req.queryRequestId(), new QueryCancelledException()); sendError(node, req.queryRequestId(), new CacheException("No query result found for request: " + req)); else if (qr.cancelled()) sendError(node, req.queryRequestId(), new QueryCancelledException()); else { MapQueryLazyWorker lazyWorker = qr.lazyWorker();
throw new QueryCancelledException(); qr.result(qryIdx).close(); throw new QueryCancelledException();