我试图使用线程池来处理janusgraph,
并使用 CompletableFuture 保持线程异步处理; -
我使用了一个 JanusGraph对象(JanusGraphFactory的女巫构建),
每个线程都会从图形对象中获得一个新的遍历源,并在结束时关闭;
然后...。处理了几分钟后,我从控制台收到了此消息...
我只是打扰了,为什么关闭它,以及是否有更好的方法来防止...。
java.lang.IllegalStateException: Graph has been closed
at org.janusgraph.graphdb.tinkerpop.JanusGraphBlueprintsGraph.getAutoStartTx(JanusGraphBlueprintsGraph.java:70)
at org.janusgraph.graphdb.tinkerpop.JanusGraphBlueprintsGraph.getCurrentThreadTx(JanusGraphBlueprintsGraph.java:89)
at org.janusgraph.graphdb.transaction.StandardJanusGraphTx.getNextTx(StandardJanusGraphTx.java:312)
at org.janusgraph.graphdb.vertices.AbstractVertex.it(AbstractVertex.java:53)
at org.janusgraph.graphdb.vertices.AbstractVertex.it(AbstractVertex.java:37)
at org.janusgraph.graphdb.internal.AbstractElement.isLoaded(AbstractElement.java:136)
at org.janusgraph.graphdb.types.vertices.JanusGraphSchemaVertex.name(JanusGraphSchemaVertex.java:51)
at org.janusgraph.graphdb.vertices.AbstractVertex.label(AbstractVertex.java:121)
at org.janusgraph.graphdb.types.system.ImplicitKey.computeProperty(ImplicitKey.java:85)
at org.janusgraph.graphdb.query.vertex.BasicVertexCentricQueryBuilder.executeImplicitKeyQuery(BasicVertexCentricQueryBuilder.java:210)
at org.janusgraph.graphdb.query.vertex.VertexCentricQueryBuilder.properties(VertexCentricQueryBuilder.java:99)
at org.janusgraph.graphdb.util.ElementHelper.getValues(ElementHelper.java:41)
at org.janusgraph.graphdb.query.condition.PredicateCondition.evaluate(PredicateCondition.java:66)
at org.janusgraph.graphdb.query.condition.And.evaluate(And.java:55)
at org.janusgraph.graphdb.query.graph.GraphCentricQuery.matches(GraphCentricQuery.java:154)
at org.janusgraph.graphdb.query.QueryProcessor$3.apply(QueryProcessor.java:146)
at org.janusgraph.graphdb.query.QueryProcessor$3.apply(QueryProcessor.java:143)
at com.google.common.collect.Iterators$7.computeNext(Iterators.java:652)
at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)
at org.janusgraph.graphdb.query.ResultSetIterator.nextInternal(ResultSetIterator.java:54)
at org.janusgraph.graphdb.query.ResultSetIterator.<init>(ResultSetIterator.java:44)
at org.janusgraph.graphdb.query.QueryProcessor.iterator(QueryProcessor.java:68)
at com.google.common.collect.Iterables$7.iterator(Iterables.java:613)
at org.janusgraph.graphdb.tinkerpop.optimize.JanusGraphStep.lambda$new$0(JanusGraphStep.java:71)
at org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep.processNextStart(GraphStep.java:142)
at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.hasNext(AbstractStep.java:143)
at org.apache.tinkerpop.gremlin.process.traversal.step.util.ExpandableStepIterator.hasNext(ExpandableStepIterator.java:42)
at org.apache.tinkerpop.gremlin.process.traversal.step.util.ReducingBarrierStep.processAllStarts(ReducingBarrierStep.java:83)
at org.apache.tinkerpop.gremlin.process.traversal.step.util.ReducingBarrierStep.processNextStart(ReducingBarrierStep.java:113)
at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.hasNext(AbstractStep.java:143)
at org.apache.tinkerpop.gremlin.process.traversal.step.util.ExpandableStepIterator.next(ExpandableStepIterator.java:50)
at org.apache.tinkerpop.gremlin.process.traversal.step.map.FlatMapStep.processNextStart(FlatMapStep.java:48)
at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.next(AbstractStep.java:128)
at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.next(AbstractStep.java:38)
at org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal.next(DefaultTraversal.java:200)
at dataTrans.KfkMsgParser.userAddressBookParser(KfkMsgParser.java:189)
at dataTrans.KfkMsgParser.parseFunction(KfkMsgParser.java:52)
at thread.PartitionThread.lambda$run$1(PartitionThread.java:54)
at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:602)
at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:577)
at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:442)
at java.lang.Thread.run(Thread.java:748)