Paul Houle created JENA-1215:
--------------------------------
Summary: Make ResultSets closeable
Key: JENA-1215
URL: https://issues.apache.org/jira/browse/JENA-1215
Project: Apache Jena
Issue Type: Improvement
Components: ARQ
Affects Versions: Jena 3.1.1
Environment: any
Reporter: Paul Houle
Currently the QueryExecution has to be closed after you are done working with a
ResultSet. This means that you can't write a function that returns a ResultSet
and expect the QueryExecution to be properly closed.
This problem can be fixed like so.
(1) Make the ResultSet interface extend ClosableIterator and probably
AutoCloseable (and fall back to just adding close() in case plan A causes
something awful to happen)
(2) Put a reference to the QueryExecution (probably just a reference to any
Autoclosable) into the StreamResultSet
(3) Have the StreamResultSet close() implementations delegate to that, or
otherwise do nothing
(4) Have the ResultSetStream close itself when it gets to the end.
(5) Make sure close on the relevant QueryExecution element is idempotent
(doesn't crash on a double close) otherwise behavior (4) followed by a later
QE.close() could cause trouble
(6) Make close() a no-op on ResultSetMem(), there is no point in punishing
users for using it or not using it.
(7) ResultSetMem does not autoclose, put it in the javadocs that a
ResultSetRewindable does not self-close, but a ResultSet which is not
Rewindable does close when it hits the end
(8) Think about what exactly to do for a ResultSetPeekable which is not
Rewindable so we don't get blindsided by a corner condition.
(9) No isClosed() method on ResultSet because it would call attention to any
fuzziness involved in (6)
I volunteer to do this.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)