NIHVIVO-3196 suppression of additional unnecessary log messages related to connection timeout and associated improvements
This commit is contained in:
parent
3bf1f4b789
commit
c8c801a6ce
9 changed files with 83 additions and 65 deletions
|
@ -38,6 +38,7 @@ log4j.logger.edu.cornell.mannlib.vitro.webapp.controller.freemarker.BrowseContro
|
||||||
log4j.logger.edu.cornell.mannlib.vitro.webapp.dao.jena.pellet.PelletListener=WARN
|
log4j.logger.edu.cornell.mannlib.vitro.webapp.dao.jena.pellet.PelletListener=WARN
|
||||||
log4j.logger.edu.cornell.mannlib.vitro.webapp.dao.jena.RDBGraphGenerator=WARN
|
log4j.logger.edu.cornell.mannlib.vitro.webapp.dao.jena.RDBGraphGenerator=WARN
|
||||||
# suppress odd warnings from libraries
|
# suppress odd warnings from libraries
|
||||||
|
log4j.logger.com.hp.hpl.jena.sdb.layout2.LoaderTuplesNodes=FATAL
|
||||||
log4j.logger.com.hp.hpl.jena.db.impl.PSet_TripleStore_RDB=FATAL
|
log4j.logger.com.hp.hpl.jena.db.impl.PSet_TripleStore_RDB=FATAL
|
||||||
log4j.logger.com.hp.hpl.jena.sdb.sql.SDBConnection=ERROR
|
log4j.logger.com.hp.hpl.jena.sdb.sql.SDBConnection=ERROR
|
||||||
log4j.logger.org.openjena.riot=FATAL
|
log4j.logger.org.openjena.riot=FATAL
|
||||||
|
|
|
@ -8,4 +8,6 @@ public interface GraphGenerator {
|
||||||
|
|
||||||
public Graph generateGraph();
|
public Graph generateGraph();
|
||||||
|
|
||||||
|
public boolean isGraphClosed();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,22 +11,23 @@ import com.hp.hpl.jena.rdf.model.ModelFactory;
|
||||||
import com.hp.hpl.jena.rdf.model.Statement;
|
import com.hp.hpl.jena.rdf.model.Statement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This listener will open and close RDB models as it performs edits to avoid
|
* This listener will open and close DB models as it performs edits to avoid
|
||||||
* wasting DB connections
|
* wasting DB connections
|
||||||
* @author bjl23
|
* @author bjl23
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class MemToRDBModelSynchronizer extends StatementListener {
|
public class MemToDBModelSynchronizer extends StatementListener {
|
||||||
|
|
||||||
private static long IDLE_MILLIS = 2000; // how long to let a model site idle after an edit has been performed
|
private static long IDLE_MILLIS = 2000; // how long to let a model site idle
|
||||||
|
// after an edit has been performed
|
||||||
|
|
||||||
RDBGraphGenerator generator;
|
SQLGraphGenerator generator;
|
||||||
Model model;
|
Model model;
|
||||||
boolean editInProgress;
|
boolean editInProgress;
|
||||||
boolean cleanupThreadActive;
|
boolean cleanupThreadActive;
|
||||||
long lastEditTimeMillis;
|
long lastEditTimeMillis;
|
||||||
|
|
||||||
public MemToRDBModelSynchronizer(RDBGraphGenerator generator) {
|
public MemToDBModelSynchronizer(SQLGraphGenerator generator) {
|
||||||
this.generator = generator;
|
this.generator = generator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +50,8 @@ public class MemToRDBModelSynchronizer extends StatementListener {
|
||||||
lastEditTimeMillis = System.currentTimeMillis();
|
lastEditTimeMillis = System.currentTimeMillis();
|
||||||
this.editInProgress = false;
|
this.editInProgress = false;
|
||||||
if (!cleanupThreadActive) {
|
if (!cleanupThreadActive) {
|
||||||
(new Thread(new Cleanup(this), "MemToRDBModelSynchronizer")).start();
|
(new Thread(
|
||||||
|
new Cleanup(this), "MemToDBModelSynchronizer")).start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,33 +65,39 @@ public class MemToRDBModelSynchronizer extends StatementListener {
|
||||||
lastEditTimeMillis = System.currentTimeMillis();
|
lastEditTimeMillis = System.currentTimeMillis();
|
||||||
this.editInProgress = false;
|
this.editInProgress = false;
|
||||||
if (!cleanupThreadActive) {
|
if (!cleanupThreadActive) {
|
||||||
(new Thread(new Cleanup(this), "MemToRDBModelSynchronizer")).start();
|
(new Thread(
|
||||||
|
new Cleanup(this), "MemToDBModelSynchronizer")).start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Cleanup implements Runnable {
|
private class Cleanup implements Runnable {
|
||||||
|
|
||||||
private MemToRDBModelSynchronizer s;
|
private MemToDBModelSynchronizer s;
|
||||||
|
|
||||||
public Cleanup(MemToRDBModelSynchronizer s) {
|
public Cleanup(MemToDBModelSynchronizer s) {
|
||||||
this.s = s;
|
this.s = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
s.cleanupThreadActive = true;
|
s.cleanupThreadActive = true;
|
||||||
while( (s.editInProgress) || (System.currentTimeMillis() - s.lastEditTimeMillis < IDLE_MILLIS ) ) {
|
while( (s.editInProgress)
|
||||||
|
|| (System.currentTimeMillis()
|
||||||
|
- s.lastEditTimeMillis < IDLE_MILLIS ) ) {
|
||||||
try {
|
try {
|
||||||
Thread.currentThread().sleep(1000);
|
Thread.currentThread().sleep(1000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
throw new RuntimeException("Interrupted cleanup thread in " + this.getClass().getName(), e);
|
throw new RuntimeException(
|
||||||
|
"Interrupted cleanup thread in "
|
||||||
|
+ this.getClass().getName(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (s.model != null) {
|
if (s.model != null) {
|
||||||
s.model.close();
|
s.model.close();
|
||||||
s.model = null;
|
s.model = null;
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException(this.getClass().getName()+"Model already null");
|
throw new RuntimeException(
|
||||||
|
this.getClass().getName() + "Model already null");
|
||||||
}
|
}
|
||||||
java.sql.Connection c = generator.getConnection();
|
java.sql.Connection c = generator.getConnection();
|
||||||
try {
|
try {
|
|
@ -17,7 +17,7 @@ import com.hp.hpl.jena.graph.Graph;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class RDBGraphGenerator implements GraphGenerator {
|
public class RDBGraphGenerator implements SQLGraphGenerator {
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(RDBGraphGenerator.class.getName());
|
private static final Log log = LogFactory.getLog(RDBGraphGenerator.class.getName());
|
||||||
|
|
||||||
|
@ -32,6 +32,14 @@ public class RDBGraphGenerator implements GraphGenerator {
|
||||||
this.graphID = graphID;
|
this.graphID = graphID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isGraphClosed() {
|
||||||
|
try {
|
||||||
|
return (connection == null || connection.isClosed());
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Graph generateGraph() {
|
public Graph generateGraph() {
|
||||||
log.info("Regenerate the graph.");
|
log.info("Regenerate the graph.");
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.dao.jena;
|
|
||||||
|
|
||||||
import com.hp.hpl.jena.db.DBConnection;
|
|
||||||
import com.hp.hpl.jena.db.IDBConnection;
|
|
||||||
import com.hp.hpl.jena.ontology.OntModel;
|
|
||||||
import com.hp.hpl.jena.ontology.OntModelSpec;
|
|
||||||
import com.hp.hpl.jena.rdf.model.Model;
|
|
||||||
import com.hp.hpl.jena.rdf.model.ModelFactory;
|
|
||||||
import com.hp.hpl.jena.rdf.model.ModelMaker;
|
|
||||||
import org.apache.commons.dbcp.BasicDataSource;
|
|
||||||
|
|
||||||
import java.sql.SQLException;
|
|
||||||
|
|
||||||
public class RDBModelGenerator implements ModelGenerator {
|
|
||||||
|
|
||||||
private BasicDataSource ds = null;
|
|
||||||
private String dbTypeStr = null;
|
|
||||||
private String modelNameStr = null;
|
|
||||||
private OntModelSpec ontModelSpec = null;
|
|
||||||
|
|
||||||
public RDBModelGenerator(BasicDataSource bds, String dbTypeStr, String modelNameStr, OntModelSpec ontModelSpec) {
|
|
||||||
this.ds = bds;
|
|
||||||
this.dbTypeStr = dbTypeStr;
|
|
||||||
this.modelNameStr = modelNameStr;
|
|
||||||
this.ontModelSpec = ontModelSpec;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OntModel generateModel() {
|
|
||||||
try {
|
|
||||||
IDBConnection conn = new DBConnection(ds.getConnection(), dbTypeStr);
|
|
||||||
ModelMaker maker = ModelFactory.createModelRDBMaker(conn);
|
|
||||||
Model model = maker.openModel(modelNameStr);
|
|
||||||
OntModel oModel = ModelFactory.createOntologyModel(ontModelSpec, model);
|
|
||||||
oModel.prepare();
|
|
||||||
return oModel;
|
|
||||||
} catch (SQLException e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.dao.jena;
|
package edu.cornell.mannlib.vitro.webapp.dao.jena;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
import com.hp.hpl.jena.graph.BulkUpdateHandler;
|
import com.hp.hpl.jena.graph.BulkUpdateHandler;
|
||||||
import com.hp.hpl.jena.graph.Capabilities;
|
import com.hp.hpl.jena.graph.Capabilities;
|
||||||
import com.hp.hpl.jena.graph.Graph;
|
import com.hp.hpl.jena.graph.Graph;
|
||||||
|
@ -22,6 +25,8 @@ import com.hp.hpl.jena.vocabulary.RDF;
|
||||||
|
|
||||||
public class RegeneratingGraph implements Graph, Regenerable {
|
public class RegeneratingGraph implements Graph, Regenerable {
|
||||||
|
|
||||||
|
private final static Log log = LogFactory.getLog(RegeneratingGraph.class);
|
||||||
|
|
||||||
private GraphGenerator generator;
|
private GraphGenerator generator;
|
||||||
private Graph g;
|
private Graph g;
|
||||||
|
|
||||||
|
@ -37,10 +42,14 @@ public class RegeneratingGraph implements Graph, Regenerable {
|
||||||
|
|
||||||
public void regenerate() {
|
public void regenerate() {
|
||||||
this.g = generator.generateGraph();
|
this.g = generator.generateGraph();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* a nonsense query that should never send back actual result data
|
||||||
|
*/
|
||||||
private void sendTestQuery() {
|
private void sendTestQuery() {
|
||||||
this.g.contains(DAML_OIL.Thing.asNode(),RDF.type.asNode(),DAML_OIL.Thing.asNode());
|
this.g.contains(
|
||||||
|
DAML_OIL.Thing.asNode(),RDF.type.asNode(),DAML_OIL.Thing.asNode());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void finalize() {
|
protected void finalize() {
|
||||||
|
@ -61,6 +70,7 @@ public class RegeneratingGraph implements Graph, Regenerable {
|
||||||
|
|
||||||
public boolean contains(Triple arg0) {
|
public boolean contains(Triple arg0) {
|
||||||
try {
|
try {
|
||||||
|
regenerateIfClosed();
|
||||||
return g.contains(arg0);
|
return g.contains(arg0);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
regenerate();
|
regenerate();
|
||||||
|
@ -70,7 +80,8 @@ public class RegeneratingGraph implements Graph, Regenerable {
|
||||||
|
|
||||||
public boolean contains(Node arg0, Node arg1, Node arg2) {
|
public boolean contains(Node arg0, Node arg1, Node arg2) {
|
||||||
try {
|
try {
|
||||||
return g.contains(arg0, arg1, arg2);
|
regenerateIfClosed();
|
||||||
|
return g.contains(arg0, arg1, arg2);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
regenerate();
|
regenerate();
|
||||||
return g.contains(arg0, arg1, arg2);
|
return g.contains(arg0, arg1, arg2);
|
||||||
|
@ -79,6 +90,7 @@ public class RegeneratingGraph implements Graph, Regenerable {
|
||||||
|
|
||||||
public void delete(Triple arg0) throws DeleteDeniedException {
|
public void delete(Triple arg0) throws DeleteDeniedException {
|
||||||
try {
|
try {
|
||||||
|
regenerateIfClosed();
|
||||||
g.delete(arg0);
|
g.delete(arg0);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
regenerate();
|
regenerate();
|
||||||
|
@ -88,6 +100,7 @@ public class RegeneratingGraph implements Graph, Regenerable {
|
||||||
|
|
||||||
public boolean dependsOn(Graph arg0) {
|
public boolean dependsOn(Graph arg0) {
|
||||||
try {
|
try {
|
||||||
|
regenerateIfClosed();
|
||||||
return g.dependsOn(arg0);
|
return g.dependsOn(arg0);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
regenerate();
|
regenerate();
|
||||||
|
@ -97,6 +110,7 @@ public class RegeneratingGraph implements Graph, Regenerable {
|
||||||
|
|
||||||
public ExtendedIterator find(TripleMatch arg0) {
|
public ExtendedIterator find(TripleMatch arg0) {
|
||||||
try {
|
try {
|
||||||
|
regenerateIfClosed();
|
||||||
return g.find(arg0);
|
return g.find(arg0);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
regenerate();
|
regenerate();
|
||||||
|
@ -106,6 +120,7 @@ public class RegeneratingGraph implements Graph, Regenerable {
|
||||||
|
|
||||||
public ExtendedIterator find(Node arg0, Node arg1, Node arg2) {
|
public ExtendedIterator find(Node arg0, Node arg1, Node arg2) {
|
||||||
try {
|
try {
|
||||||
|
regenerateIfClosed();
|
||||||
return g.find(arg0,arg1,arg2);
|
return g.find(arg0,arg1,arg2);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
regenerate();
|
regenerate();
|
||||||
|
@ -115,6 +130,7 @@ public class RegeneratingGraph implements Graph, Regenerable {
|
||||||
|
|
||||||
public BulkUpdateHandler getBulkUpdateHandler() {
|
public BulkUpdateHandler getBulkUpdateHandler() {
|
||||||
try {
|
try {
|
||||||
|
regenerateIfClosed();
|
||||||
sendTestQuery();
|
sendTestQuery();
|
||||||
return g.getBulkUpdateHandler();
|
return g.getBulkUpdateHandler();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -125,6 +141,7 @@ public class RegeneratingGraph implements Graph, Regenerable {
|
||||||
|
|
||||||
public Capabilities getCapabilities() {
|
public Capabilities getCapabilities() {
|
||||||
try {
|
try {
|
||||||
|
regenerateIfClosed();
|
||||||
sendTestQuery();
|
sendTestQuery();
|
||||||
return g.getCapabilities();
|
return g.getCapabilities();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -136,6 +153,7 @@ public class RegeneratingGraph implements Graph, Regenerable {
|
||||||
|
|
||||||
public GraphEventManager getEventManager() {
|
public GraphEventManager getEventManager() {
|
||||||
try {
|
try {
|
||||||
|
regenerateIfClosed();
|
||||||
sendTestQuery();
|
sendTestQuery();
|
||||||
return g.getEventManager();
|
return g.getEventManager();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -147,6 +165,7 @@ public class RegeneratingGraph implements Graph, Regenerable {
|
||||||
|
|
||||||
public PrefixMapping getPrefixMapping() {
|
public PrefixMapping getPrefixMapping() {
|
||||||
try {
|
try {
|
||||||
|
regenerateIfClosed();
|
||||||
sendTestQuery();
|
sendTestQuery();
|
||||||
return g.getPrefixMapping();
|
return g.getPrefixMapping();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -158,6 +177,7 @@ public class RegeneratingGraph implements Graph, Regenerable {
|
||||||
|
|
||||||
public Reifier getReifier() {
|
public Reifier getReifier() {
|
||||||
try {
|
try {
|
||||||
|
regenerateIfClosed();
|
||||||
sendTestQuery();
|
sendTestQuery();
|
||||||
return g.getReifier();
|
return g.getReifier();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -169,6 +189,7 @@ public class RegeneratingGraph implements Graph, Regenerable {
|
||||||
|
|
||||||
public GraphStatisticsHandler getStatisticsHandler() {
|
public GraphStatisticsHandler getStatisticsHandler() {
|
||||||
try {
|
try {
|
||||||
|
regenerateIfClosed();
|
||||||
sendTestQuery();
|
sendTestQuery();
|
||||||
return g.getStatisticsHandler();
|
return g.getStatisticsHandler();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -180,6 +201,7 @@ public class RegeneratingGraph implements Graph, Regenerable {
|
||||||
|
|
||||||
public TransactionHandler getTransactionHandler() {
|
public TransactionHandler getTransactionHandler() {
|
||||||
try {
|
try {
|
||||||
|
regenerateIfClosed();
|
||||||
sendTestQuery();
|
sendTestQuery();
|
||||||
return g.getTransactionHandler();
|
return g.getTransactionHandler();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -191,6 +213,7 @@ public class RegeneratingGraph implements Graph, Regenerable {
|
||||||
|
|
||||||
public boolean isClosed() {
|
public boolean isClosed() {
|
||||||
try {
|
try {
|
||||||
|
regenerateIfClosed();
|
||||||
return g.isClosed();
|
return g.isClosed();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
regenerate();
|
regenerate();
|
||||||
|
@ -201,6 +224,7 @@ public class RegeneratingGraph implements Graph, Regenerable {
|
||||||
|
|
||||||
public boolean isEmpty() {
|
public boolean isEmpty() {
|
||||||
try {
|
try {
|
||||||
|
regenerateIfClosed();
|
||||||
return g.isEmpty();
|
return g.isEmpty();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
regenerate();
|
regenerate();
|
||||||
|
@ -211,6 +235,7 @@ public class RegeneratingGraph implements Graph, Regenerable {
|
||||||
|
|
||||||
public boolean isIsomorphicWith(Graph arg0) {
|
public boolean isIsomorphicWith(Graph arg0) {
|
||||||
try {
|
try {
|
||||||
|
regenerateIfClosed();
|
||||||
return g.isIsomorphicWith(arg0);
|
return g.isIsomorphicWith(arg0);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
regenerate();
|
regenerate();
|
||||||
|
@ -221,6 +246,7 @@ public class RegeneratingGraph implements Graph, Regenerable {
|
||||||
|
|
||||||
public QueryHandler queryHandler() {
|
public QueryHandler queryHandler() {
|
||||||
try {
|
try {
|
||||||
|
regenerateIfClosed();
|
||||||
sendTestQuery();
|
sendTestQuery();
|
||||||
return g.queryHandler();
|
return g.queryHandler();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -232,6 +258,7 @@ public class RegeneratingGraph implements Graph, Regenerable {
|
||||||
|
|
||||||
public int size() {
|
public int size() {
|
||||||
try {
|
try {
|
||||||
|
regenerateIfClosed();
|
||||||
return g.size();
|
return g.size();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
regenerate();
|
regenerate();
|
||||||
|
@ -242,11 +269,18 @@ public class RegeneratingGraph implements Graph, Regenerable {
|
||||||
|
|
||||||
public void add(Triple arg0) throws AddDeniedException {
|
public void add(Triple arg0) throws AddDeniedException {
|
||||||
try {
|
try {
|
||||||
|
regenerateIfClosed();
|
||||||
g.add(arg0);
|
g.add(arg0);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
regenerate();
|
regenerate();
|
||||||
g.add(arg0);
|
g.add(arg0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void regenerateIfClosed() {
|
||||||
|
if (generator.isGraphClosed()) {
|
||||||
|
regenerate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ import com.hp.hpl.jena.sdb.StoreDesc;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
public class SDBGraphGenerator implements GraphGenerator {
|
public class SDBGraphGenerator implements SQLGraphGenerator {
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(SDBGraphGenerator.class.getName());
|
private static final Log log = LogFactory.getLog(SDBGraphGenerator.class.getName());
|
||||||
|
|
||||||
|
@ -28,6 +28,14 @@ public class SDBGraphGenerator implements GraphGenerator {
|
||||||
this.storeDesc = storeDesc;
|
this.storeDesc = storeDesc;
|
||||||
this.graphID = graphID;
|
this.graphID = graphID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isGraphClosed() {
|
||||||
|
try {
|
||||||
|
return (connection == null || connection.isClosed());
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Graph generateGraph() {
|
public Graph generateGraph() {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.dao.jena;
|
package edu.cornell.mannlib.vitro.webapp.dao.jena;
|
||||||
|
|
||||||
import com.hp.hpl.jena.ontology.OntModel;
|
import java.sql.Connection;
|
||||||
|
|
||||||
public interface ModelGenerator {
|
public interface SQLGraphGenerator extends GraphGenerator {
|
||||||
|
|
||||||
public OntModel generateModel();
|
|
||||||
|
|
||||||
|
public Connection getConnection();
|
||||||
|
|
||||||
}
|
}
|
|
@ -346,7 +346,7 @@ public class VitroJenaModelMaker implements ModelMaker {
|
||||||
Graph g = gen.generateGraph();
|
Graph g = gen.generateGraph();
|
||||||
Model m = ModelFactory.createModelForGraph(g);
|
Model m = ModelFactory.createModelForGraph(g);
|
||||||
memCache.add(m);
|
memCache.add(m);
|
||||||
memCache.register(new MemToRDBModelSynchronizer(gen));
|
memCache.register(new MemToDBModelSynchronizer(gen));
|
||||||
m.close();
|
m.close();
|
||||||
try {
|
try {
|
||||||
gen.getConnection().close();
|
gen.getConnection().close();
|
||||||
|
|
Loading…
Add table
Reference in a new issue