jena-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Seaborne <andy.seabo...@epimorphics.com>
Subject Re: Unexpected requirement to call DatasetGraphTDB.finishRequest
Date Mon, 07 Feb 2011 20:45:12 GMT


On 07/02/11 14:28, Christian Brenninkmeijer wrote:
> Hi,
>
> I noticed (the hard way) that
> DatasetGraphTDB.close() does not call DatasetGraphTDB.finishRequest()
> before closing the graph.
> This then causes a NoSuchElementException when the dataset is later used.

Could you provide the stacktrace please?

>
> Senario:
> I loaded a graph from rdf using TDBLoader.loadGraph
> I added the graph to the dataset using addGraph
>
> I queried the dataset with success. Closing the query.
>
> I closed the dataset and then reopened it.

Ah - this might be more the issue. Are you creating the datset via 
TDBFactory?  That has a cache of datasets (to avoid two attempts to open 
the same location withotu sharing the caches).

> Exact same query with the exact same code failed.

Yes - close means close, not to be used again.

> I then added DatasetGraphTDB.finishRequest()before closing the dataset
> and it worked.
> How I agree calling finishRequest() is good programing style and I
> should have done that.

> However writing close() expecting a user to have called finishRequest()
> is poor style.
>

DatasetGraphTDB.finishRequest() calls sync() - close should also be 
doing that as well.

Normally, finishRequest() isn't needed and my first attempt to recreate 
the situation didn't have any problems.  I've probably not quiet 
understood the sequence of actions - could you provide a complete, 
minimal example so I can run it at my end please?

	Andy

Mime
View raw message