예제 #1
0
 @Override
 public synchronized void rollback() {
   Preconditions.checkArgument(isOpen(), "The transaction has already been closed");
   try {
     txHandle.rollback();
   } catch (Exception e) {
     throw new TitanException("Could not rollback transaction due to exception", e);
   } finally {
     close();
   }
 }
예제 #2
0
 @Override
 public synchronized void commit() {
   Preconditions.checkArgument(isOpen(), "The transaction has already been closed");
   try {
     if (hasModifications()) {
       graph.save(addedRelations.getAll(), deletedRelations.values(), this);
     }
     txHandle.commit();
   } catch (Exception e) {
     try {
       txHandle.rollback();
     } catch (StorageException e1) {
       throw new TitanException("Could not rollback after a failed commit", e);
     }
     throw new TitanException(
         "Could not commit transaction due to exception during persistence", e);
   } finally {
     close();
   }
 }