
|
If you were logged in you would be able to see more operations.
|
|
If you have a query with ORDER BY, it will lock the iteration, and prevent a timeout or cancellation from working.
Test:
public void testOrderByQueriesAreInterruptable() throws Exception {
Repository repository = new SailRepository(new MemoryStore());
repository.initialize();
RepositoryConnection connection = repository.getConnection();
try {
for (int index = 0; index < 35; index++) {
connection.add(OWL.CLASS, RDFS.COMMENT, connection.getValueFactory().createBNode());
}
connection.commit();
} finally {
connection.close();
}
connection = repository.getConnection();
try {
String queryString = "SELECT * WHERE { ?s ?p ?o . ?s1 ?p1 ?o1 . ?s2 ?p2 ?o2 . ?s3 ?p3 ?o3 } ORDER BY ?s1 ?p1 ?o1";
TupleQuery query = connection.prepareTupleQuery(QueryLanguage.SPARQL, queryString);
query.setMaxQueryTime(5);
long startTime = System.currentTimeMillis();
TupleQueryResult result = query.evaluate();
try {
result.hasNext();
fail("Query should have been interrupted");
} catch (QueryInterruptedException e) {
// Expected
long duration = System.currentTimeMillis() - startTime;
assertTrue("Query not interrupted quickly enough, should have been 5s, but was "
+ (duration / 1000) + "s", duration < 10000);
}
} finally {
connection.close();
}
}
|
|
OrderIterator.handleClose() now closes the underlying iterator (the one that is being iterated for ordering) before closing itself. This will interrupt the ordering process, preventing the long wait for the OrderIterator to be able to close itself.
|
|