You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Andy Seaborne (JIRA)" <ji...@apache.org> on 2014/09/02 23:18:21 UTC

[jira] [Updated] (JENA-775) Jena TDB doesn't seem to release all file handles when dataset is closed

     [ https://issues.apache.org/jira/browse/JENA-775?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andy Seaborne updated JENA-775:
-------------------------------
    Description: 
Jena TDB doesn't allow renaming of a TDB directory after a dataset has been opened and a model has been added.  It appears as though there is an open file handle that is preventing the rename from succeeding.  The following JUnit test fails:

{noformat}
import java.io.File;
import junit.framework.Assert;
import org.junit.Test;
import com.hp.hpl.jena.query.Dataset;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.tdb.StoreConnection;
import com.hp.hpl.jena.tdb.TDBFactory;
import com.hp.hpl.jena.tdb.base.file.Location;
import com.hp.hpl.jena.vocabulary.RDFS;

@Test
public void testRename() {
	String path = "C:\\tmp\\indexTdb";
	Dataset ds = TDBFactory.createDataset(path);
	StoreConnection.make(path);
	Model model = ds.getNamedModel(RDFS.Class.getURI());
	ds.addNamedModel(RDFS.Class.getURI(), model);
	ds.close();
	StoreConnection.release(new Location(path));
	File tdbRename = new File(path);
	Assert.assertTrue(tdbRename.renameTo(new File("C:\\tmp\indexTdbMoved")));
}
{noformat}

  was:
Jena TDB doesn't allow renaming of a TDB directory after a dataset has been opened and a model has been added.  It appears as though there is an open file handle that is preventing the rename from succeeding.  The following JUnit test fails:

import java.io.File;
import junit.framework.Assert;
import org.junit.Test;
import com.hp.hpl.jena.query.Dataset;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.tdb.StoreConnection;
import com.hp.hpl.jena.tdb.TDBFactory;
import com.hp.hpl.jena.tdb.base.file.Location;
import com.hp.hpl.jena.vocabulary.RDFS;

@Test
public void testRename() {
	String path = "C:\\tmp\\indexTdb";
	Dataset ds = TDBFactory.createDataset(path);
	StoreConnection.make(path);
	Model model = ds.getNamedModel(RDFS.Class.getURI());
	ds.addNamedModel(RDFS.Class.getURI(), model);
	ds.close();
	StoreConnection.release(new Location(path));
	File tdbRename = new File(path);
	Assert.assertTrue(tdbRename.renameTo(new File("C:\\tmp\indexTdbMoved")));
}


> Jena TDB doesn't seem to release all file handles when dataset is closed
> ------------------------------------------------------------------------
>
>                 Key: JENA-775
>                 URL: https://issues.apache.org/jira/browse/JENA-775
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: TDB
>    Affects Versions: TDB 1.0.2
>         Environment: Windows
>            Reporter: Matthew Jarvis
>
> Jena TDB doesn't allow renaming of a TDB directory after a dataset has been opened and a model has been added.  It appears as though there is an open file handle that is preventing the rename from succeeding.  The following JUnit test fails:
> {noformat}
> import java.io.File;
> import junit.framework.Assert;
> import org.junit.Test;
> import com.hp.hpl.jena.query.Dataset;
> import com.hp.hpl.jena.rdf.model.Model;
> import com.hp.hpl.jena.tdb.StoreConnection;
> import com.hp.hpl.jena.tdb.TDBFactory;
> import com.hp.hpl.jena.tdb.base.file.Location;
> import com.hp.hpl.jena.vocabulary.RDFS;
> @Test
> public void testRename() {
> 	String path = "C:\\tmp\\indexTdb";
> 	Dataset ds = TDBFactory.createDataset(path);
> 	StoreConnection.make(path);
> 	Model model = ds.getNamedModel(RDFS.Class.getURI());
> 	ds.addNamedModel(RDFS.Class.getURI(), model);
> 	ds.close();
> 	StoreConnection.release(new Location(path));
> 	File tdbRename = new File(path);
> 	Assert.assertTrue(tdbRename.renameTo(new File("C:\\tmp\indexTdbMoved")));
> }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)