diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/task/ServerInfoManager.java b/hugegraph-core/src/main/java/org/apache/hugegraph/task/ServerInfoManager.java index e8cccf88e3..ab1ecceca3 100644 --- a/hugegraph-core/src/main/java/org/apache/hugegraph/task/ServerInfoManager.java +++ b/hugegraph-core/src/main/java/org/apache/hugegraph/task/ServerInfoManager.java @@ -17,14 +17,13 @@ package org.apache.hugegraph.task; -import static org.apache.hugegraph.backend.query.Query.NO_LIMIT; - import java.util.Collection; import java.util.Iterator; import java.util.Map; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; +import com.google.common.collect.ImmutableMap; import org.apache.hugegraph.HugeException; import org.apache.hugegraph.HugeGraph; import org.apache.hugegraph.HugeGraphParams; @@ -49,7 +48,7 @@ import org.apache.tinkerpop.gremlin.structure.Vertex; import org.slf4j.Logger; -import com.google.common.collect.ImmutableMap; +import static org.apache.hugegraph.backend.query.Query.NO_LIMIT; public class ServerInfoManager { diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/CountTraverser.java b/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/CountTraverser.java index 1f23f0a1e4..83b3747e0a 100644 --- a/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/CountTraverser.java +++ b/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/CountTraverser.java @@ -32,6 +32,7 @@ import org.apache.hugegraph.iterator.FlatMapperIterator; import org.apache.hugegraph.structure.HugeEdge; import org.apache.hugegraph.util.E; +import org.apache.tinkerpop.gremlin.structure.util.CloseableIterator; public class CountTraverser extends HugeTraverser { @@ -93,12 +94,7 @@ public long count(Id source, List steps, return this.count.longValue(); } finally { - if (edges instanceof FlatMapperIterator) { - try { - ((FlatMapperIterator)edges).close(); - } catch (Exception ignored) { - } - } + CloseableIterator.closeIterator(edges); } }