public QueryIterDistinct(QueryIterator qIter, ExecutionContext execCxt) { super(qIter, execCxt) ; if ( execCxt != null ) { memThreshold = execCxt.getContext().getLong(ARQ.spillToDiskThreshold, memThreshold) ; if ( memThreshold < 0 ) throw new ARQException("BAd spillToDiskThreshold: "+memThreshold) ; } }
/** * A threshold policy based on the {@link org.apache.jena.query.ARQ#spillToDiskThreshold} symbol in the given Context. * If the symbol is not set, then the {@link #never()} policy is used by default. */ public static <E> ThresholdPolicy<E> policyFromContext(Context context) { long threshold = context.getLong(ARQ.spillToDiskThreshold, defaultThreshold) ; if ( threshold >= 0 ) { return count(threshold); } else { return never() ; } } }
@Test(expected=ARQException.class) public void testCxt9() { Context cxt = new Context() ; assertEquals(-1L, cxt.getLong(p1, -1L)) ; cxt.set(p1, 1L) ; // Bad. Long for Integer. cxt.getInt(p1, -2) ; } }