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(); } }