我在删除关系时遇到了奇怪的问题。
我认为这是某种僵局的发生。这是代码
Transaction txBegin = graphDb.beginTx();
try {
for (Relationship r : GlobalGraphOperations.at(graphDb).getAllRelationships()) {
for(String indexName : graphDb.index().relationshipIndexNames()) {
graphDb.index().forRelationships(indexName).remove(r);
}
}
r.delete(); // EXCEPTION HERE
}
这是我得到的堆栈跟踪
Thread [16462692@qtp-14650787-39 - /db/data/ext/MyGraph/graphdb/deleteAll] (Suspended)
waiting for: RWLock (id=90)
Object.wait(long) line: not available [native method]
RWLock(Object).wait() line: 503
RWLock.acquireWriteLock(Transaction) line: 341
LockManagerImpl.getWriteLock(Object, Transaction) line: 133
WritableTransactionState.acquireWriteLock(Object) line: 279
NodeManager.deleteRelationship(RelationshipImpl, TransactionState) line: 837
OldTxStateBridgeImpl.deleteRelationship(long) line: 150
TxStateImpl.relationshipDoDelete(long) line: 263
StateHandlingStatementOperations.relationshipDelete(Statement, long) line: 90
ConstraintEnforcingEntityWriteOperations.relationshipDelete(Statement, long) line: 143
LockingStatementOperations.relationshipDelete(Statement, long) line: 188
DataStatement.relationshipDelete(long) line: 62
RelationshipProxy.delete() line: 86
MyGraph.deleteAll(GraphDatabaseService) line: 188
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]