Permalink
Browse files

Replaced the usage of a deprecated

TransactionalGraph.stopTransaction(Conclusion conclusion);

To the appropriate method (commit() / rollback()).
  • Loading branch information...
asaf committed Jan 3, 2013
1 parent 69b1015 commit 0dd97e1b8d98a74061709183120044055f68add2
@@ -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)
@@ -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();;
}
}
}
@@ -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);
}
@@ -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);
}
@@ -115,7 +115,7 @@ public static void inputGraph(final Graph inputGraph, final InputStream jsonInpu
jp.close();
- graph.stopTransaction(TransactionalGraph.Conclusion.SUCCESS);
+ graph.commit();;
}
@@ -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;
@@ -601,7 +601,7 @@ protected void closeAllSessionCollections() {
*/
@Override
public void shutdown() {
- stopTransaction(Conclusion.SUCCESS);
+ commit();
db.close();
dex.close();
@@ -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;
}
}
@@ -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();;
}
}
}
@@ -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) {
@@ -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
}
@@ -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) {
Oops, something went wrong.

0 comments on commit 0dd97e1

Please sign in to comment.