use of org.neo4j.kernel.impl.nioneo.store.RelationshipData in project graphdb by neo4j-attic.
the class NodeManager method getRelationshipById.
public Relationship getRelationshipById(long relId) throws NotFoundException {
RelationshipImpl relationship = relCache.get(relId);
if (relationship != null) {
return new RelationshipProxy(relId, this);
}
ReentrantLock loadLock = lockId(relId);
try {
relationship = relCache.get(relId);
if (relationship != null) {
return new RelationshipProxy(relId, this);
}
RelationshipData data = persistenceManager.loadLightRelationship(relId);
if (data == null) {
throw new NotFoundException("Relationship[" + relId + "]");
}
int typeId = data.relationshipType();
RelationshipType type = getRelationshipTypeById(typeId);
if (type == null) {
throw new NotFoundException("Relationship[" + data.getId() + "] exist but relationship type[" + typeId + "] not found.");
}
final long startNodeId = data.firstNode();
final long endNodeId = data.secondNode();
relationship = new RelationshipImpl(relId, startNodeId, endNodeId, type, false);
relCache.put(relId, relationship);
return new RelationshipProxy(relId, this);
} finally {
loadLock.unlock();
}
}
Aggregations