From 404723193d6de6f2349a33cfc2a92763354ad70a Mon Sep 17 00:00:00 2001 From: zhangyi51 Date: Wed, 13 Jan 2021 15:39:59 +0800 Subject: [PATCH] improve Change-Id: I0f473063f6df1e43170f01a655a87a1c790f028a --- .../main/java/com/baidu/hugegraph/task/TaskCallable.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/task/TaskCallable.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/task/TaskCallable.java index 5f475d6503..ce3d26c644 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/task/TaskCallable.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/task/TaskCallable.java @@ -22,6 +22,7 @@ import java.util.Date; import java.util.concurrent.Callable; +import org.apache.tinkerpop.gremlin.structure.Transaction; import org.slf4j.Logger; import com.baidu.hugegraph.HugeException; @@ -56,8 +57,9 @@ protected void cancelled() { } protected void closeTx() { - if (this.graph().tx().isOpen()) { - this.graph().tx().close(); + Transaction tx = this.graph().tx(); + if (tx.isOpen()) { + tx.close(); } }