Skip to content

Commit

Permalink
fix: use closable iterator util to close autoclosable edges rather th…
Browse files Browse the repository at this point in the history
…an mannually close it
  • Loading branch information
qwtsc committed Aug 18, 2023
1 parent 2ae0f6c commit 0c99338
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -93,12 +94,7 @@ public long count(Id source, List<EdgeStep> steps,

return this.count.longValue();
} finally {
if (edges instanceof FlatMapperIterator) {
try {
((FlatMapperIterator<?, ?>)edges).close();
} catch (Exception ignored) {
}
}
CloseableIterator.closeIterator(edges);
}
}

Expand Down

0 comments on commit 0c99338

Please sign in to comment.