/** * Check the deadline on the query. If the query is not terminated and the * deadline has expired, then the query is terminated as a side-effect. * * @param nowNanosIsIgnored * A current timestamp. * * @return <code>null</code> if the query is terminated and * <code>this</code> if the query is not terminated. */ QueryDeadline checkDeadline(final long nowNanosIsIgnored) { final AbstractRunningQuery q = queryRef.get(); if (q == null) { /* * The weak reference to the query has been cleared. This query is * known to be terminated. */ return null; } // Check the deadline. q.checkDeadline(); if (q.isDone()) { // Query is terminated. return null; } // Query is running and deadline is not expired. return this; }
/** * Check the deadline on the query. If the query is not terminated and the * deadline has expired, then the query is terminated as a side-effect. * * @param nowNanosIsIgnored * A current timestamp. * * @return <code>null</code> if the query is terminated and * <code>this</code> if the query is not terminated. */ QueryDeadline checkDeadline(final long nowNanosIsIgnored) { final AbstractRunningQuery q = queryRef.get(); if (q == null) { /* * The weak reference to the query has been cleared. This query is * known to be terminated. */ return null; } // Check the deadline. q.checkDeadline(); if (q.isDone()) { // Query is terminated. return null; } // Query is running and deadline is not expired. return this; }
@Override public String toString() { final StringBuilder sb = new StringBuilder(getClass().getName()); sb.append("{queryId=" + queryId); /* * Note: Obtaining the lock here is required to avoid concurrent * modification exception in RunState's toString() when there is a * concurrent change in the RunState. It also makes the isDone() and * isCancelled() reporting atomic. */ lock.lock(); try { sb.append(",elapsed=" + getElapsed()); sb.append(",deadline=" + runState.getDeadline()); sb.append(",isDone=" + isDone()); sb.append(",isCancelled=" + isCancelled()); sb.append(",runState=" + runState); } finally { lock.unlock(); } sb.append(",controller=" + controller); sb.append(",clientProxy=" + clientProxy); sb.append(",query=" + query); sb.append("}"); return sb.toString(); }
@Override public String toString() { final StringBuilder sb = new StringBuilder(getClass().getName()); sb.append("{queryId=" + queryId); /* * Note: Obtaining the lock here is required to avoid concurrent * modification exception in RunState's toString() when there is a * concurrent change in the RunState. It also makes the isDone() and * isCancelled() reporting atomic. */ lock.lock(); try { sb.append(",elapsed=" + getElapsed()); sb.append(",deadline=" + runState.getDeadline()); sb.append(",isDone=" + isDone()); sb.append(",isCancelled=" + isCancelled()); sb.append(",runState=" + runState); } finally { lock.unlock(); } sb.append(",controller=" + controller); sb.append(",clientProxy=" + clientProxy); sb.append(",query=" + query); sb.append("}"); return sb.toString(); }
if (q != null && !q.isDone()) q.consumeChunk(); } catch (InterruptedException e) {
if (q != null && !q.isDone()) q.consumeChunk(); } catch (InterruptedException e) {
if (isDone()) {