/** * 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; }