示例#1
0
 public NodeImpl getNodeForProxy(long nodeId, LockType lock) {
   if (lock != null) {
     lock.acquire(getTransactionState(), new NodeProxy(nodeId, nodeLookup));
   }
   NodeImpl node = getLightNode(nodeId);
   if (node == null) {
     throw new NotFoundException(format("Node %d not found", nodeId));
   }
   return node;
 }
示例#2
0
 public RelationshipImpl getRelationshipForProxy(long relId, LockType lock) {
   if (lock != null) {
     lock.acquire(getTransactionState(), new RelationshipProxy(relId, relationshipLookups));
   }
   RelationshipImpl relationship = relCache.get(relId);
   if (relationship != null) {
     return relationship;
   }
   ReentrantLock loadLock = lockId(relId);
   try {
     relationship = relCache.get(relId);
     if (relationship != null) {
       return relationship;
     }
     RelationshipRecord data = persistenceManager.loadLightRelationship(relId);
     if (data == null) {
       throw new NotFoundException(format("Relationship %d not found", relId));
     }
     int typeId = data.getType();
     RelationshipType type = getRelationshipTypeById(typeId);
     if (type == null) {
       throw new NotFoundException(
           "Relationship["
               + data.getId()
               + "] exist but relationship type["
               + typeId
               + "] not found.");
     }
     relationship =
         newRelationshipImpl(
             relId, data.getFirstNode(), data.getSecondNode(), type, typeId, false);
     // relCache.put( relId, relationship );
     relCache.put(relationship);
     return relationship;
   } finally {
     loadLock.unlock();
   }
 }
示例#3
0
 @Override
 public String toString() {
   return String.format("%s_LOCK(%s)", lockType.name(), lock);
 }
示例#4
0
 public void release() {
   lockType.release(lockManager, lock, tx);
 }