[ 
https://issues.apache.org/jira/browse/JENA-307?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13442423#comment-13442423
 ] 

Andy Seaborne commented on JENA-307:
------------------------------------

Related to JENA-305

Yes, it's sort of a bug.  Better management of QueryExecution objects is 
required.

The executeQuery method in SPARQL_Query sets up the result set but does not 
fully execute the query.  Closing the execution at that point will cause no 
results to be returned.

One way would be to attach them to the HttpActionQuery object for final 
clearup.  Indeed, adding a mechanism to HttpAction for action finalizers would 
be one general appraoch (a similar mechanism as was done in Joseki).

Or pull up the initial code from executeQuery so teh QueryExecution object is 
available after sendResults.

                
> QueryExecution is not being closed in SPARQL_Query.execute method. 
> -------------------------------------------------------------------
>
>                 Key: JENA-307
>                 URL: https://issues.apache.org/jira/browse/JENA-307
>             Project: Apache Jena
>          Issue Type: Question
>          Components: Fuseki
>    Affects Versions: Fuseki 0.2.4
>            Reporter: Priyaranjan
>
> QueryExecution is not being closed in SPARQL_Query.execute method. 
> In the execute method , after sending the results , only the dataset.end() 
> method is called to end the transation. But the QueryExecution that 
> was created is never closed. 
> This is in contrary to the examples provided at 
> http://jena.apache.org/documentation/tdb/tdb_transactions.html for Read 
> Transcations , 
> where the qExec.close is called before calling dataset.end
> Location location = ... ;
>  Dataset dataset = ... ;
>  dataset.begin(ReadWrite.READ) ;
>  try {
>      QueryExecution qExec = QueryExecutionFactory.create("SELECT * {?s ?p ?o} 
> LIMIT 10", dataset) ;
>      ResultSet rs = qExec.execSelect() ;
>      try {
>          ResultSetFormatter.out(rs) ;
>      } finally { qExec.close() ; }
>      // Another query - same view of the data.
>      qExec = QueryExecutionFactory.create("SELECT * {?s ?p ?o} OFFSET 10 
> LIMIT 10", dataset) ;
>      rs = qExec.execSelect() ;
>      try {
>          ResultSetFormatter.out(rs) ;
>      } finally { qExec.close() ; }
>  } finally { dataset.end() ; }
> Is this a bug in Fuseki ?
> In my application , I am creating a database connection , when the 
> QueryExecution is created , and I need to close the connection when 
> the QueryExecution is closed. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to