Исключение: график был закрыт - PullRequest
0 голосов
/ 03 ноября 2018

Я пытался использовать пул потоков для обработки janusgraph,
и использование CompletableFuture для поддержания асинхронной обработки потоков; -

Я использую один объект JanusGraph (сборка ведьмы из JanusGraphFactory),
и каждый поток получал бы новый traversalsource из графического объекта и закрывался, когда они заканчивались;

затем .... После обработки несколько минут я получаю эти сообщения из консоли ...

и мне просто надоело, почему он закрылся и есть ли лучший способ предотвратить ....

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)  
...