【发布时间】:2015-11-16 22:30:35
【问题描述】:
这可能是用于访问一些 Neo4j 数据的典型 Java 7 样板。
是否存在任何机制,您可以将事务设置为根据超时自动失败和回滚?
try (Transaction tx = graphdb.beginTx()) {
Node node = // Get some Nodes ...
Iterable<Relationship> rels = node.getRelationships(...);
for (Relationship rel : rels) {
// Oh no! This is a super-node with a billion Relationships!
}
tx.success();
return data;
}
我猜只有int count = 0 并增加每次迭代,然后:
if(count > XYZ) throw TakingTooLongException(count)
?
【问题讨论】:
标签: performance transactions neo4j