if (q.isDone() && q.getCause() != null) { final UUID queryId = q.getQueryId();
public void close() { if (open.compareAndSet(true/* expect */, false/* update */)) { try { runningQuery.cancel(true/* mayInterruptIfRunning */); } finally { src.close(); } } }
/** * Test for abnormal completion of the {@link IRunningQuery}. */ private void checkFuture() { // if (!checkedFuture && runningQuery.isDone()) { try { runningQuery.get(); } catch (InterruptedException e) { /* * Interrupted while waiting on the Future (should not happen * since the Future is already done). */ throw new RuntimeException(e); } catch (Throwable e) { /* * Exception thrown by the runningQuery. */ if (runningQuery.getCause() != null) { // abnormal termination - wrap and rethrow. throw new RuntimeException(e); } // otherwise this is normal termination. } checkedFuture = true; // } }
final UUID childId = childQuery.getQueryId(); childQuery.cancel(true/* mayInterruptIfRunning */); throw new RuntimeException("Query is done");
final BOpStats stats = runningQuery.getStats().get( subqueryId); assertEquals(2L, stats.chunksIn.get()); assertTrue(runningQuery.isDone()); assertFalse(runningQuery.isCancelled()); runningQuery.get(); // verify nothing thrown.
final long elapsed = q.getElapsed(); final UUID serviceId = q.getQueryEngine().getServiceUUID(); final Throwable cause = q.getCause(); sb.append(q.getQueryId()); sb.append('\t'); sb.append(dateFormat.format(new Date(q.getStartTime()))); sb.append('\t'); sb.append(dateFormat.format(new Date(q.getDoneTime()))); sb.append('\t'); if(q.getDeadline()!=Long.MAX_VALUE) sb.append(dateFormat.format(new Date(q.getDeadline()))); sb.append('\t'); sb.append(elapsed); final Map<Integer, BOp> bopIndex = q.getBOpIndex(); final Map<Integer, BOpStats> statsMap = q.getStats(); final BOp bop = bopIndex.get(bopId); sb.append(BOpUtility.toString(q.getQuery()).replace('\n', ' ')); sb.append('\t'); // evalOrder sb.append("total"); if (t != null) { final IQueryAttributes attrs = t == null ? null : t .getAttributes();
assertFalse(runningQuery.isDone()); final ICloseableIterator<IBindingSet[]> itr = runningQuery.iterator(); assertFalse(runningQuery.isDone()); assertTrue(runningQuery.isCancelled()); try { runningQuery.get(); fail("Expecting: " + CancellationException.class); } catch (CancellationException ex) {
final StaticAnalysisStats saStats = q.getStaticAnalysisStats(); .getChildren(); final long elapsedMillis = q.getElapsed(); final BOpStats stats = q.getStats().get( q.getQuery().getId()); .text(", subqueries=" + children.length)// .text(", elapsed=" + elapsedMillis + "ms")// .text(q.isCancelled()?", CANCELLED.":".") .close(); final boolean clusterStats = q.getFederation() != null;
/** * Verify the expected solutions. * * @param expected * The expected solutions. * @param runningQuery * The running query whose solutions will be verified. */ static public void assertSameSolutions( final IBindingSet[] expected, final IRunningQuery runningQuery) { assertSameSolutions(expected, runningQuery.iterator(), runningQuery); }
/** * Return the {@link IQueryAttributes} associated with this query. * * @return The {@link IQueryAttributes}. */ public IQueryAttributes getQueryAttributes() { return getRunningQuery().getAttributes(); }
private boolean _hasNext() { if (current != null) { // Already buffered. return true; } if (!src.hasNext()) { // Source is exhausted. return false; } // buffer the next element. current = src.next(); if (!checkedFuture && runningQuery.isDone()) { checkFuture(); } // the next element is now buffered. return true; }
runningQuery.setStaticAnalysisStats(ctx.getStaticAnalysisStats()); if (runningQuery != null) { runningQuery.cancel(true/* mayInterruptIfRunning */);
final BOpStats stats = runningQuery.getStats().get( subqueryId); assertEquals(2L, stats.chunksIn.get()); assertTrue(runningQuery.isDone()); assertFalse(runningQuery.isCancelled()); runningQuery.get(); // verify nothing thrown.
final long elapsed = q.getElapsed(); final UUID serviceId = q.getQueryEngine().getServiceUUID(); final Throwable cause = q.getCause(); sb.append(q.getQueryId()); sb.append('\t'); sb.append(dateFormat.format(new Date(q.getStartTime()))); sb.append('\t'); sb.append(dateFormat.format(new Date(q.getDoneTime()))); sb.append('\t'); if(q.getDeadline()!=Long.MAX_VALUE) sb.append(dateFormat.format(new Date(q.getDeadline()))); sb.append('\t'); sb.append(elapsed); final Map<Integer, BOp> bopIndex = q.getBOpIndex(); final Map<Integer, BOpStats> statsMap = q.getStats(); final BOp bop = bopIndex.get(bopId); sb.append(BOpUtility.toString(q.getQuery()).replace('\n', ' ')); sb.append('\t'); // evalOrder sb.append("total"); if (t != null) { final IQueryAttributes attrs = t == null ? null : t .getAttributes();