Skip to content
Browse files

Replaced the usage of a deprecated

TransactionalGraph.stopTransaction(Conclusion conclusion);

To the appropriate method (commit() / rollback()).
  • Loading branch information...
1 parent 69b1015 commit 0dd97e1b8d98a74061709183120044055f68add2 @asaf asaf committed
View
2 blueprints-core/src/main/java/com/tinkerpop/blueprints/ThreadedTransactionalGraph.java
@@ -5,7 +5,7 @@
* While TransactionalGraph binds each transaction to the executing thread, ThreadedTransactionalGraph's {@link #startTransaction} returns a {@link TransactionalGraph} that represents its own transactional context independent of the executing thread.
* Hence, one can have multiple threads operating against a single transaction represented by the returned TransactionalGraph object. This is useful for parallelizing graph algorithms.
* <p/>
- * Note, that one needs to call {@link TransactionalGraph#stopTransaction(com.tinkerpop.blueprints.TransactionalGraph.Conclusion)} to close the transactions returned
+ * Note, that one needs to call {@link TransactionalGraph#commit()} or {@link TransactionalGraph#rollback()} to close the transactions returned
* by {@link #startTransaction()}.
*
* @author Matthias Brocheler (http://matthiasb.com)
View
2 blueprints-core/src/main/java/com/tinkerpop/blueprints/util/KeyIndexableGraphHelper.java
@@ -33,7 +33,7 @@ public static long reIndexElements(final Graph graph, final Iterable<? extends E
element.setProperty(key, value);
if (isTransactional && (counter % 1000 == 0)) {
- ((TransactionalGraph) graph).stopTransaction(TransactionalGraph.Conclusion.SUCCESS);
+ ((TransactionalGraph) graph).commit();;
}
}
}
View
2 blueprints-core/src/main/java/com/tinkerpop/blueprints/util/io/gml/GMLReader.java
@@ -151,7 +151,7 @@ public static void inputGraph(final Graph inputGraph, final InputStream inputStr
new GMLParser(graph, defaultEdgeLabel, vertexIdKey, edgeIdKey, edgeLabelKey).parse(st);
- graph.stopTransaction(TransactionalGraph.Conclusion.SUCCESS);
+ graph.commit();;
} catch (IOException e) {
throw new IOException("GML malformed line number " + st.lineno() + ": ", e);
}
View
2 blueprints-core/src/main/java/com/tinkerpop/blueprints/util/io/graphml/GraphMLReader.java
@@ -243,7 +243,7 @@ else if ((edgeIdKey != null) && (key.equals(edgeIdKey)))
reader.close();
- graph.stopTransaction(TransactionalGraph.Conclusion.SUCCESS);
+ graph.commit();;
} catch (XMLStreamException xse) {
throw new IOException(xse);
}
View
2 blueprints-core/src/main/java/com/tinkerpop/blueprints/util/io/graphson/GraphSONReader.java
@@ -115,7 +115,7 @@ public static void inputGraph(final Graph inputGraph, final InputStream jsonInpu
jp.close();
- graph.stopTransaction(TransactionalGraph.Conclusion.SUCCESS);
+ graph.commit();;
}
View
6 blueprints-core/src/main/java/com/tinkerpop/blueprints/util/wrappers/batch/BatchGraph.java
@@ -235,7 +235,7 @@ private void nextElement() {
currentEdge = null;
currentEdgeCached = null;
if (remainingBufferSize <= 0) {
- baseGraph.stopTransaction(Conclusion.SUCCESS);
+ baseGraph.commit();
cache.newTransaction();
remainingBufferSize = bufferSize;
}
@@ -254,7 +254,7 @@ public void stopTransaction(final Conclusion conclusion) {
currentEdge = null;
currentEdgeCached = null;
remainingBufferSize = 0;
- baseGraph.stopTransaction(Conclusion.SUCCESS);
+ baseGraph.commit();
}
public void commit() {
@@ -270,7 +270,7 @@ public void rollback() {
@Override
public void shutdown() {
- baseGraph.stopTransaction(Conclusion.SUCCESS);
+ baseGraph.commit();
baseGraph.shutdown();
currentEdge = null;
currentEdgeCached = null;
View
2 blueprints-dex-graph/src/main/java/com/tinkerpop/blueprints/impls/dex/DexGraph.java
@@ -601,7 +601,7 @@ protected void closeAllSessionCollections() {
*/
@Override
public void shutdown() {
- stopTransaction(Conclusion.SUCCESS);
+ commit();
db.close();
dex.close();
View
10 ...ints-dex-graph/src/test/java/com/tinkerpop/blueprints/impls/dex/DexSpecificTestSuite.java
@@ -115,19 +115,19 @@ public void testTx() {
TransactionalGraph graph = (TransactionalGraph) graphTest.generateGraph();
this.stopWatch();
- graph.stopTransaction(Conclusion.SUCCESS);
+ graph.commit();
graph.addVertex(null).setProperty("name", "sergio");
graph.addVertex(null).setProperty("name", "marko");
assertTrue(graph.getVertices("name", "sergio").iterator().next()
.getProperty("name").equals("sergio"));
- graph.stopTransaction(Conclusion.SUCCESS);
+ graph.commit();
assertTrue(((DexGraph) graph).getRawSession(false) == null);
assertTrue(graph.getVertices("name", "sergio").iterator().next().getProperty("name").equals("sergio"));
- graph.stopTransaction(Conclusion.SUCCESS);
+ graph.commit();
assertTrue(((DexGraph) graph).getRawSession(false) == null);
- graph.stopTransaction(Conclusion.SUCCESS);
+ graph.commit();
assertTrue(((DexGraph) graph).getRawSession(false) == null);
graph.addVertex(null);
@@ -156,7 +156,7 @@ public void run() {
}
}
}
- tg.stopTransaction(Conclusion.SUCCESS);
+ tg.commit();
finished = true;
}
}
View
2 blueprints-graph-sail/src/main/java/com/tinkerpop/blueprints/oupls/sail/GraphSail.java
@@ -142,7 +142,7 @@ public GraphSail(final T graph, final String indexedPatterns) {
store.namespaces = store.addVertex(NAMESPACES_VERTEX_ID);
} finally {
if (store.manualTransactions) {
- ((TransactionalGraph) graph).stopTransaction(TransactionalGraph.Conclusion.SUCCESS);
+ ((TransactionalGraph) graph).commit();;
}
}
}
View
2 ...nts-graph-sail/src/main/java/com/tinkerpop/blueprints/oupls/sail/GraphSailConnection.java
@@ -55,7 +55,7 @@ protected void startTransactionInternal() throws SailException {
public void commitInternal() throws SailException {
if (store.manualTransactions) {
- ((TransactionalGraph) store.graph).stopTransaction(TransactionalGraph.Conclusion.SUCCESS);
+ ((TransactionalGraph) store.graph).commit();;
}
if (statementsAdded || statementsRemoved) {
View
8 blueprints-neo4j-graph/src/main/java/com/tinkerpop/blueprints/impls/neo4j/Neo4jGraph.java
@@ -167,9 +167,9 @@ private void freshLoad() {
try {
this.autoStartTransaction();
this.removeVertex(this.getVertex(0));
- this.stopTransaction(Conclusion.SUCCESS);
+ this.commit();
} catch (Exception e) {
- this.stopTransaction(Conclusion.FAILURE);
+ this.rollback();
}
}
@@ -263,7 +263,7 @@ public synchronized void dropIndex(final String indexName) {
relationshipIndex.delete();
}
}
- this.stopTransaction(Conclusion.SUCCESS);
+ this.commit();
}
@@ -487,7 +487,7 @@ public void rollback() {
public void shutdown() {
try {
- this.stopTransaction(Conclusion.SUCCESS);
+ this.commit();
} catch (TransactionFailureException e) {
//TODO: inspect why certain transactions fail
}
View
4 blueprints-sail-graph/src/main/java/com/tinkerpop/blueprints/impls/sail/SailGraph.java
@@ -323,7 +323,7 @@ public void removeNamespace(final String prefix) {
*/
public void loadRDF(final InputStream input, final String baseURI, final String format, final String baseGraph) {
try {
- this.stopTransaction(Conclusion.SUCCESS);
+ this.commit();
final SailConnection c = this.rawGraph.getConnection();
try {
RDFParser p = Rio.createParser(getFormat(format));
@@ -375,7 +375,7 @@ private void closeAllConnections() throws SailException {
public synchronized void shutdown() {
try {
- this.stopTransaction(Conclusion.SUCCESS);
+ this.commit();
closeAllConnections();
this.rawGraph.shutDown();
} catch (Throwable e) {
View
82 blueprints-test/src/main/java/com/tinkerpop/blueprints/TransactionalGraphTestSuite.java
@@ -27,9 +27,9 @@ public void testTrue() {
public void testRepeatedTransactionStopException() {
TransactionalGraph graph = (TransactionalGraph) graphTest.generateGraph();
- graph.stopTransaction(Conclusion.SUCCESS);
- graph.stopTransaction(Conclusion.FAILURE);
- graph.stopTransaction(Conclusion.SUCCESS);
+ graph.commit();
+ graph.rollback();
+ graph.commit();
graph.shutdown();
}
@@ -38,7 +38,7 @@ public void testAutoStartTransaction() {
Vertex v1 = graph.addVertex(null);
vertexCount(graph, 1);
assertEquals(v1.getId(), graph.getVertex(v1.getId()).getId());
- graph.stopTransaction(Conclusion.SUCCESS);
+ graph.commit();
vertexCount(graph, 1);
assertEquals(v1.getId(), graph.getVertex(v1.getId()).getId());
graph.shutdown();
@@ -51,7 +51,7 @@ public void testTransactionsForVertices() {
List<Vertex> vin = new ArrayList<Vertex>();
List<Vertex> vout = new ArrayList<Vertex>();
vin.add(graph.addVertex(null));
- graph.stopTransaction(Conclusion.SUCCESS);
+ graph.commit();
vertexCount(graph, 1);
containsVertices(graph, vin);
@@ -60,7 +60,7 @@ public void testTransactionsForVertices() {
vertexCount(graph, 2);
containsVertices(graph, vin);
containsVertices(graph, vout);
- graph.stopTransaction(Conclusion.FAILURE);
+ graph.rollback();
containsVertices(graph, vin);
vertexCount(graph, 1);
@@ -70,7 +70,7 @@ public void testTransactionsForVertices() {
vin.add(graph.addVertex(null));
vertexCount(graph, 2);
containsVertices(graph, vin);
- graph.stopTransaction(Conclusion.SUCCESS);
+ graph.commit();
printPerformance(graph.toString(), 1, "vertex added in successful transaction", this.stopWatch());
vertexCount(graph, 2);
containsVertices(graph, vin);
@@ -85,17 +85,17 @@ public void testBasicVertexEdgeTransactions() {
assertEquals(count(v.getEdges(Direction.IN)), 1);
assertEquals(count(v.getEdges(Direction.OUT)), 1);
assertEquals(v.getEdges(Direction.IN).iterator().next(), v.getEdges(Direction.OUT).iterator().next());
- graph.stopTransaction(Conclusion.SUCCESS);
+ graph.commit();
v = graph.getVertex(v.getId());
assertEquals(count(v.getEdges(Direction.IN)), 1);
assertEquals(count(v.getEdges(Direction.OUT)), 1);
assertEquals(v.getEdges(Direction.IN).iterator().next(), v.getEdges(Direction.OUT).iterator().next());
- graph.stopTransaction(Conclusion.SUCCESS);
+ graph.commit();
v = graph.getVertex(v.getId());
assertEquals(count(v.getVertices(Direction.IN)), 1);
assertEquals(count(v.getVertices(Direction.OUT)), 1);
assertEquals(v.getVertices(Direction.IN).iterator().next(), v.getVertices(Direction.OUT).iterator().next());
- graph.stopTransaction(Conclusion.SUCCESS);
+ graph.commit();
graph.shutdown();
}
@@ -105,7 +105,7 @@ public void testBruteVertexTransactions() {
this.stopWatch();
for (int i = 0; i < 100; i++) {
vin.add(graph.addVertex(null));
- graph.stopTransaction(Conclusion.SUCCESS);
+ graph.commit();
}
printPerformance(graph.toString(), 100, "vertices added in 100 successful transactions", this.stopWatch());
vertexCount(graph, 100);
@@ -114,13 +114,13 @@ public void testBruteVertexTransactions() {
this.stopWatch();
for (int i = 0; i < 100; i++) {
vout.add(graph.addVertex(null));
- graph.stopTransaction(Conclusion.FAILURE);
+ graph.rollback();
}
printPerformance(graph.toString(), 100, "vertices not added in 100 failed transactions", this.stopWatch());
vertexCount(graph, 100);
containsVertices(graph, vin);
- graph.stopTransaction(Conclusion.FAILURE);
+ graph.rollback();
vertexCount(graph, 100);
containsVertices(graph, vin);
@@ -131,7 +131,7 @@ public void testBruteVertexTransactions() {
}
vertexCount(graph, 200);
containsVertices(graph, vin);
- graph.stopTransaction(Conclusion.SUCCESS);
+ graph.commit();
printPerformance(graph.toString(), 100, "vertices added in 1 successful transactions", this.stopWatch());
vertexCount(graph, 200);
containsVertices(graph, vin);
@@ -143,7 +143,7 @@ public void testBruteVertexTransactions() {
vertexCount(graph, 300);
containsVertices(graph, vin);
containsVertices(graph, vout.subList(100, 200));
- graph.stopTransaction(Conclusion.FAILURE);
+ graph.rollback();
printPerformance(graph.toString(), 100, "vertices not added in 1 failed transactions", this.stopWatch());
vertexCount(graph, 200);
containsVertices(graph, vin);
@@ -155,7 +155,7 @@ public void testTransactionsForEdges() {
Vertex v = graph.addVertex(null);
Vertex u = graph.addVertex(null);
- graph.stopTransaction(Conclusion.SUCCESS);
+ graph.commit();
this.stopWatch();
Edge e = graph.addEdge(null, graph.getVertex(v.getId()), graph.getVertex(u.getId()), convertId(graph, "test"));
@@ -169,7 +169,7 @@ public void testTransactionsForEdges() {
vertexCount(graph, 2);
edgeCount(graph, 1);
- graph.stopTransaction(Conclusion.FAILURE);
+ graph.rollback();
printPerformance(graph.toString(), 1, "edge not added in failed transaction (w/ iteration)", this.stopWatch());
assertEquals(graph.getVertex(v.getId()), v);
@@ -196,7 +196,7 @@ public void testTransactionsForEdges() {
if (graph.getFeatures().supportsEdgeIteration)
assertEquals(count(graph.getEdges()), 1);
assertEquals(e, getOnlyElement(graph.getVertex(u.getId()).getEdges(Direction.OUT)));
- graph.stopTransaction(Conclusion.SUCCESS);
+ graph.commit();
printPerformance(graph.toString(), 1, "edge added in successful transaction (w/ iteration)", this.stopWatch());
if (graph.getFeatures().supportsVertexIteration)
@@ -220,7 +220,7 @@ public void testBruteEdgeTransactions() {
Vertex v = graph.addVertex(null);
Vertex u = graph.addVertex(null);
graph.addEdge(null, v, u, convertId(graph, "test"));
- graph.stopTransaction(Conclusion.SUCCESS);
+ graph.commit();
}
printPerformance(graph.toString(), 100, "edges added in 100 successful transactions (2 vertices added for each edge)", this.stopWatch());
vertexCount(graph, 200);
@@ -231,7 +231,7 @@ public void testBruteEdgeTransactions() {
Vertex v = graph.addVertex(null);
Vertex u = graph.addVertex(null);
graph.addEdge(null, v, u, convertId(graph, "test"));
- graph.stopTransaction(Conclusion.FAILURE);
+ graph.rollback();
}
printPerformance(graph.toString(), 100, "edges not added in 100 failed transactions (2 vertices added for each edge)", this.stopWatch());
vertexCount(graph, 200);
@@ -245,7 +245,7 @@ public void testBruteEdgeTransactions() {
}
vertexCount(graph, 400);
edgeCount(graph, 200);
- graph.stopTransaction(Conclusion.SUCCESS);
+ graph.commit();
printPerformance(graph.toString(), 100, "edges added in 1 successful transactions (2 vertices added for each edge)", this.stopWatch());
vertexCount(graph, 400);
edgeCount(graph, 200);
@@ -259,7 +259,7 @@ public void testBruteEdgeTransactions() {
vertexCount(graph, 600);
edgeCount(graph, 300);
- graph.stopTransaction(Conclusion.FAILURE);
+ graph.rollback();
printPerformance(graph.toString(), 100, "edges not added in 1 failed transactions (2 vertices added for each edge)", this.stopWatch());
vertexCount(graph, 400);
edgeCount(graph, 200);
@@ -275,7 +275,7 @@ public void testPropertyTransactions() {
Vertex v = graph.addVertex(null);
Object id = v.getId();
v.setProperty("name", "marko");
- graph.stopTransaction(Conclusion.SUCCESS);
+ graph.commit();
printPerformance(graph.toString(), 1, "vertex added with string property in a successful transaction", this.stopWatch());
@@ -285,7 +285,7 @@ public void testPropertyTransactions() {
assertEquals(v.getProperty("name"), "marko");
v.setProperty("age", 30);
assertEquals(v.getProperty("age"), 30);
- graph.stopTransaction(Conclusion.FAILURE);
+ graph.rollback();
printPerformance(graph.toString(), 1, "integer property not added in a failed transaction", this.stopWatch());
this.stopWatch();
@@ -297,7 +297,7 @@ public void testPropertyTransactions() {
Edge edge = graph.addEdge(null, v, graph.addVertex(null), "test");
edgeCount(graph, 1);
- graph.stopTransaction(Conclusion.SUCCESS);
+ graph.commit();
edgeCount(graph, 1);
edge = getOnlyElement(graph.getVertex(v.getId()).getEdges(Direction.OUT));
assertNotNull(edge);
@@ -305,7 +305,7 @@ public void testPropertyTransactions() {
this.stopWatch();
edge.setProperty("transaction-1", "success");
assertEquals(edge.getProperty("transaction-1"), "success");
- graph.stopTransaction(Conclusion.SUCCESS);
+ graph.commit();
printPerformance(graph.toString(), 1, "edge property added and checked in a successful transaction", this.stopWatch());
edge = getOnlyElement(graph.getVertex(v.getId()).getEdges(Direction.OUT));
assertEquals(edge.getProperty("transaction-1"), "success");
@@ -314,7 +314,7 @@ public void testPropertyTransactions() {
edge.setProperty("transaction-2", "failure");
assertEquals(edge.getProperty("transaction-1"), "success");
assertEquals(edge.getProperty("transaction-2"), "failure");
- graph.stopTransaction(Conclusion.FAILURE);
+ graph.rollback();
printPerformance(graph.toString(), 1, "edge property added and checked in a failed transaction", this.stopWatch());
edge = getOnlyElement(graph.getVertex(v.getId()).getEdges(Direction.OUT));
assertEquals(edge.getProperty("transaction-1"), "success");
@@ -336,7 +336,7 @@ public void testIndexTransactions() {
v = getOnlyElement(((IndexableGraph) graph).getIndex("txIdx", Vertex.class).get("name", "marko"));
assertEquals(v.getId(), id);
assertEquals(v.getProperty("name"), "marko");
- graph.stopTransaction(Conclusion.SUCCESS);
+ graph.commit();
printPerformance(graph.toString(), 1, "vertex added and retrieved from index in a successful transaction", this.stopWatch());
@@ -357,7 +357,7 @@ public void testIndexTransactions() {
assertEquals(v.getProperty("name"), "marko");
v = getOnlyElement(((IndexableGraph) graph).getIndex("txIdx", Vertex.class).get("name", "pavel"));
assertEquals(v.getProperty("name"), "pavel");
- graph.stopTransaction(Conclusion.FAILURE);
+ graph.rollback();
printPerformance(graph.toString(), 1, "vertex not added in a failed transaction", this.stopWatch());
this.stopWatch();
@@ -392,7 +392,7 @@ public void testAutomaticSuccessfulTransactionOnShutdown() {
public void testVertexCountOnPreTransactionCommit() {
TransactionalGraph graph = (TransactionalGraph) graphTest.generateGraph();
Vertex v1 = graph.addVertex(null);
- graph.stopTransaction(Conclusion.SUCCESS);
+ graph.commit();
vertexCount(graph, 1);
@@ -402,7 +402,7 @@ public void testVertexCountOnPreTransactionCommit() {
vertexCount(graph, 2);
- graph.stopTransaction(Conclusion.SUCCESS);
+ graph.commit();
vertexCount(graph, 2);
graph.shutdown();
@@ -414,14 +414,14 @@ public void testBulkTransactionsOnEdges() {
graph.addEdge(null, graph.addVertex(null), graph.addVertex(null), convertId(graph, "test"));
}
edgeCount(graph, 5);
- graph.stopTransaction(Conclusion.FAILURE);
+ graph.rollback();
edgeCount(graph, 0);
for (int i = 0; i < 4; i++) {
graph.addEdge(null, graph.addVertex(null), graph.addVertex(null), convertId(graph, "test"));
}
edgeCount(graph, 4);
- graph.stopTransaction(Conclusion.FAILURE);
+ graph.rollback();
edgeCount(graph, 0);
@@ -429,7 +429,7 @@ public void testBulkTransactionsOnEdges() {
graph.addEdge(null, graph.addVertex(null), graph.addVertex(null), convertId(graph, "test"));
}
edgeCount(graph, 3);
- graph.stopTransaction(Conclusion.SUCCESS);
+ graph.commit();
edgeCount(graph, 3);
graph.shutdown();
@@ -458,7 +458,7 @@ public void run() {
}
vertices.getAndAdd(2);
edges.getAndAdd(1);
- graph.stopTransaction(Conclusion.SUCCESS);
+ graph.commit();
} else {
Vertex a = graph.addVertex(null);
Vertex b = graph.addVertex(null);
@@ -469,11 +469,11 @@ public void run() {
e.setProperty("bloop", random.nextInt());
}
if (random.nextBoolean()) {
- graph.stopTransaction(Conclusion.SUCCESS);
+ graph.commit();
vertices.getAndAdd(2);
edges.getAndAdd(1);
} else {
- graph.stopTransaction(Conclusion.FAILURE);
+ graph.rollback();
}
}
completedThreads.getAndAdd(1);
@@ -503,7 +503,7 @@ public void testCompetingThreadsOnMultipleDbInstances() throws Exception {
public void run() {
final Vertex v = graph1.addVertex(null);
v.setProperty("name", "stephen");
- graph1.stopTransaction(Conclusion.SUCCESS);
+ graph1.commit();
}
};
@@ -544,7 +544,7 @@ public void testRemoveInTransaction() {
Object v1id = v1.getId();
Vertex v2 = graph.addVertex(null);
Edge e1 = graph.addEdge(null, v1, v2, convertId(graph, "test-edge"));
- graph.stopTransaction(Conclusion.SUCCESS);
+ graph.commit();
edgeCount(graph, 1);
e1 = getOnlyElement(graph.getVertex(v1id).getEdges(Direction.OUT));
@@ -552,14 +552,14 @@ public void testRemoveInTransaction() {
graph.removeEdge(e1);
edgeCount(graph, 0);
assertNull(getOnlyElement(graph.getVertex(v1id).getEdges(Direction.OUT)));
- graph.stopTransaction(Conclusion.FAILURE);
+ graph.rollback();
edgeCount(graph, 1);
e1 = getOnlyElement(graph.getVertex(v1id).getEdges(Direction.OUT));
assertNotNull(e1);
graph.removeEdge(e1);
- graph.stopTransaction(Conclusion.SUCCESS);
+ graph.commit();
edgeCount(graph, 0);
assertNull(getOnlyElement(graph.getVertex(v1id).getEdges(Direction.OUT)));
View
6 ...rints-test/src/test/java/com/tinkerpop/blueprints/util/wrappers/batch/BatchGraphTest.java
@@ -193,7 +193,7 @@ public void loadingTest(int total, int bufferSize, BatchGraph.IdType type, Loadi
previous = next;
}
- loader.stopTransaction(TransactionalGraph.Conclusion.SUCCESS);
+ loader.commit();;
assertTrue(tgraph.allSuccessful());
loader.shutdown();
@@ -279,11 +279,11 @@ public void stopTransaction(Conclusion conclusion) {
}
public void rollback() {
- this.stopTransaction(Conclusion.FAILURE);
+ this.rollback();
}
public void commit() {
- this.stopTransaction(Conclusion.SUCCESS);
+ this.commit();
}
@Override

0 comments on commit 0dd97e1

Please sign in to comment.
Something went wrong with that request. Please try again.