Return-Path: X-Original-To: apmail-tinkerpop-commits-archive@minotaur.apache.org Delivered-To: apmail-tinkerpop-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BF670190A5 for ; Thu, 7 Apr 2016 19:39:14 +0000 (UTC) Received: (qmail 34746 invoked by uid 500); 7 Apr 2016 19:39:14 -0000 Delivered-To: apmail-tinkerpop-commits-archive@tinkerpop.apache.org Received: (qmail 34723 invoked by uid 500); 7 Apr 2016 19:39:14 -0000 Mailing-List: contact commits-help@tinkerpop.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tinkerpop.incubator.apache.org Delivered-To: mailing list commits@tinkerpop.incubator.apache.org Received: (qmail 34714 invoked by uid 99); 7 Apr 2016 19:39:14 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Apr 2016 19:39:14 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id CFB34C064A for ; Thu, 7 Apr 2016 19:39:13 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -3.221 X-Spam-Level: X-Spam-Status: No, score=-3.221 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001] autolearn=disabled Received: from mx2-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id OhqMHQHUz-Oy for ; Thu, 7 Apr 2016 19:39:12 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx2-lw-us.apache.org (ASF Mail Server at mx2-lw-us.apache.org) with SMTP id 968D25FB3F for ; Thu, 7 Apr 2016 19:39:11 +0000 (UTC) Received: (qmail 34711 invoked by uid 99); 7 Apr 2016 19:39:11 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Apr 2016 19:39:11 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E73D4DFE04; Thu, 7 Apr 2016 19:39:10 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: spmallette@apache.org To: commits@tinkerpop.incubator.apache.org Message-Id: <4d16187360a049f8ae559761a0942984@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: incubator-tinkerpop git commit: Fix TINKERPOP-1252 Date: Thu, 7 Apr 2016 19:39:10 +0000 (UTC) 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 Authored: Wed Apr 6 22:02:12 2016 -0600 Committer: Geoff Reedy 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 { @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(); } }