コード例 #1
0
ファイル: StandardTitanTx.java プロジェクト: rafatuita/titan
 @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
ファイル: StandardTitanTx.java プロジェクト: rafatuita/titan
 @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();
   }
 }