@Override public void setMaxQueryTime(int secs) { query.setMaxQueryTime(secs); }
public void setMaxQueryTime(int sec) { query.setMaxQueryTime(sec); }
@Override public void setMaxQueryTime(int secs) { query.setMaxQueryTime(secs); }
@Override public void setMaxQueryTime(int secs) { query.setMaxQueryTime(secs); }
public void setMaxQueryTime(int limit) { delegate.setMaxQueryTime(limit); }
public void setMaxQueryTime(int sec) { query.setMaxQueryTime(sec); }
tupleQuery.setMaxQueryTime(timeout.intValue());
"SELECT * WHERE { ?s ?p ?o . ?s1 ?p1 ?o1 . ?s2 ?p2 ?o2 . ?s3 ?p3 ?o3 . } ORDER BY ?s1 ?p1 ?o1 LIMIT 1000"); query.setMaxQueryTime((int) (MAX_QUERY_TIME / 1000));
@Test public void testOrderByQueriesAreInterruptable() throws Exception { testCon.begin(); for (int index = 0; index < 512; index++) { testCon.add(RDFS.CLASS, RDFS.COMMENT, testCon.getValueFactory().createBNode()); } testCon.commit(); final TupleQuery query = testCon.prepareTupleQuery(QueryLanguage.SPARQL, "SELECT * WHERE { ?s ?p ?o . ?s1 ?p1 ?o1 . ?s2 ?p2 ?o2 . ?s3 ?p3 ?o3 } ORDER BY ?s1 ?p1 ?o1 LIMIT 1000"); query.setMaxQueryTime(2); final TupleQueryResult result = query.evaluate(); final long startTime = System.currentTimeMillis(); try { result.hasNext(); fail("Query should have been interrupted"); } catch (QueryInterruptedException e) { // Expected final long duration = System.currentTimeMillis() - startTime; assertTrue("Query not interrupted quickly enough, should have been ~2s, but was " + (duration / 1000) + "s", duration < 5000); } }
"SELECT * WHERE { ?s ?p ?o . ?s1 ?p1 ?o1 . ?s2 ?p2 ?o2 . ?s3 ?p3 ?o3 . } ORDER BY ?s1 ?p1 ?o1 LIMIT 1000"); query.setMaxQueryTime((int) (MAX_QUERY_TIME / 1000));
TupleQueryResult res = null; try { query.setMaxQueryTime(60); // TODO how to retrieve max query value
@Test public void testOrderByQueriesAreInterruptable() throws Exception { testCon.begin(); for (int index = 0; index < 512; index++) { testCon.add(RDFS.CLASS, RDFS.COMMENT, testCon.getValueFactory().createBNode()); } testCon.commit(); final TupleQuery query = testCon.prepareTupleQuery(QueryLanguage.SPARQL, "SELECT * WHERE { ?s ?p ?o . ?s1 ?p1 ?o1 . ?s2 ?p2 ?o2 . ?s3 ?p3 ?o3 } ORDER BY ?s1 ?p1 ?o1 LIMIT 1000"); query.setMaxQueryTime(2); final TupleQueryResult result = query.evaluate(); final long startTime = System.currentTimeMillis(); try { result.hasNext(); fail("Query should have been interrupted"); } catch (QueryInterruptedException e) { // Expected final long duration = System.currentTimeMillis() - startTime; assertTrue("Query not interrupted quickly enough, should have been ~2s, but was " + (duration / 1000) + "s", duration < 5000); } }