tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spmalle...@apache.org
Subject incubator-tinkerpop git commit: Fix TINKERPOP-1252
Date Thu, 07 Apr 2016 19:39:10 GMT
Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/tp31 e859bb5c3 -> f56e597dd


Fix TINKERPOP-1252

It is now ensured that if there was any problem committing or rolling
back a transaction then the ThreadLocal binding to a Neo4j transaction
will be cleared.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/f56e597d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/f56e597d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/f56e597d

Branch: refs/heads/tp31
Commit: f56e597dd9fc061a26da9319f67674e77c2de810
Parents: e859bb5
Author: Geoff Reedy <geoff@programmer-monk.net>
Authored: Wed Apr 6 22:02:12 2016 -0600
Committer: Geoff Reedy <geoff@programmer-monk.net>
Committed: Thu Apr 7 18:27:32 2016 +0000

----------------------------------------------------------------------
 .../tinkerpop/gremlin/neo4j/structure/Neo4jGraph.java     | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/f56e597d/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jGraph.java
----------------------------------------------------------------------
diff --git a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jGraph.java
b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jGraph.java
index 010e592..6f896af 100644
--- a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jGraph.java
+++ b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jGraph.java
@@ -332,24 +332,22 @@ public final class Neo4jGraph implements Graph, WrappedGraph<Neo4jGraphAPI>
{
 
         @Override
         public void doCommit() throws TransactionException {
-            try {
-                threadLocalTx.get().success();
+            try (Neo4jTx tx = threadLocalTx.get()) {
+                tx.success();
             } catch (Exception ex) {
                 throw new TransactionException(ex);
             } finally {
-                threadLocalTx.get().close();
                 threadLocalTx.remove();
             }
         }
 
         @Override
         public void doRollback() throws TransactionException {
-            try {
-                threadLocalTx.get().failure();
+            try (Neo4jTx tx = threadLocalTx.get()) {
+                tx.failure();
             } catch (Exception e) {
                 throw new TransactionException(e);
             } finally {
-                threadLocalTx.get().close();
                 threadLocalTx.remove();
             }
         }


Mime
View raw message