Beispiel #1
0
 public void removeRelation(InternalRelation relation) {
   Preconditions.checkArgument(!relation.isRemoved());
   relation = relation.it();
   // Delete from Vertex
   for (int i = 0; i < relation.getLen(); i++) {
     relation.getVertex(i).removeRelation(relation);
   }
   // Update transaction data structures
   if (relation.isNew()) {
     addedRelations.remove(relation);
     if (isVertexIndexProperty(relation)) newVertexIndexEntries.remove((TitanProperty) relation);
   } else {
     Preconditions.checkArgument(relation.isLoaded());
     if (deletedRelations == EMPTY_DELETED_RELATIONS) {
       if (config.isSingleThreaded()) {
         deletedRelations = new HashMap<Long, InternalRelation>();
       } else {
         synchronized (this) {
           if (deletedRelations == EMPTY_DELETED_RELATIONS)
             deletedRelations = new ConcurrentHashMap<Long, InternalRelation>();
         }
       }
     }
     deletedRelations.put(Long.valueOf(relation.getID()), relation);
   }
 }