Merge pull request #514 from y-higuchi/init_frames_once
Init FramedGraph only once when a base Graph is created.
diff --git a/src/main/java/net/onrc/onos/graph/GraphDBConnection.java b/src/main/java/net/onrc/onos/graph/GraphDBConnection.java
index bf30297..7938bb6 100644
--- a/src/main/java/net/onrc/onos/graph/GraphDBConnection.java
+++ b/src/main/java/net/onrc/onos/graph/GraphDBConnection.java
@@ -33,6 +33,7 @@
.getLogger(GraphDBConnection.class);
private static GraphDBConnection singleton = new GraphDBConnection();
private static TitanGraph graph;
+ private static FramedGraph<TitanGraph> fg;
private static EventTransactionalGraph<TitanGraph> eg;
private static String configFile;
@@ -85,6 +86,7 @@
graph.createKeyIndex("ipv4_address", Vertex.class);
}
graph.commit();
+ fg = new FramedGraph<TitanGraph>(graph);
eg = new EventTransactionalGraph<TitanGraph>(graph);
}
return singleton;
@@ -95,13 +97,7 @@
*/
@Override
public FramedGraph<TitanGraph> getFramedGraph() {
- if (isValid()) {
- FramedGraph<TitanGraph> fg = new FramedGraph<TitanGraph>(graph);
- return fg;
- } else {
- log.error("new FramedGraph failed");
- return null;
- }
+ return fg;
}
/**
@@ -136,11 +132,11 @@
/**
* Commit changes for the graph operations.
- * @throws Exception
+ * @throws Exception
*/
@Override
public void commit() {
-// // Should not catch exception here!
+// // Should not catch exception here!
// try {
graph.commit();
// }
@@ -154,7 +150,7 @@
*/
@Override
public void rollback() {
- // Should not catch exception here!
+ // Should not catch exception here!
// try {
graph.rollback();
// }