private void reverseTransactions(ArrayList<DataStore> restoreList,Throwable cause){
  for (  DataStore dataStore : restoreList) {
    try (DataStoreTransaction transaction=dataStore.beginTransaction()){
      List<Object> list=dirtyObjects.get(dataStore);
      for (      Object dirtyObject : list == null ? Collections.emptyList() : list) {
        Object cloned=clonedObjects.get(dirtyObject);
        if (cloned == NEWLY_CREATED_OBJECT) {
          transaction.delete(dirtyObject);
        }
 else {
          transaction.save(cloned);
        }
      }
      transaction.commit();
    }
 catch (    RuntimeException|IOException e) {
      cause.addSuppressed(e);
    }
  }
}

private void reverseTransactions ( ArrayList < DataStore > restoreList , Throwable cause ) { for ( DataStore dataStore : restoreList ) { try ( DataStoreTransaction transaction = dataStore . beginTransaction ( ) ) { List < Object > list = dirtyObjects . get ( dataStore ) ; for ( Object dirtyObject : list == null ? Collections . emptyList ( ) : list ) { Object cloned = clonedObjects . get ( dirtyObject ) ; if ( cloned == NEWLY_CREATED_OBJECT ) { transaction . delete ( dirtyObject ) ; } else { transaction . save ( cloned ) ; } } transaction . commit ( ) ; } catch ( RuntimeException | IOException e ) { cause . addSuppressed ( e ) ; } } }
attempt to reverse changes of last commit since not all transactions successfully committed .
