Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8270


Ignore:
Timestamp:
07/10/12 09:56:20 (12 years ago)
Author:
spimming
Message:

#1888: Caution: disabled transactions in the TransactionManager

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/OaaS/HeuristicLab.Services.Hive.DataAccess/3.3/TransactionManager.cs

    r7259 r8270  
    2222using System;
    2323using System.Transactions;
    24 using HeuristicLab.Services.Hive.DataAccess;
    2524
    26 namespace HeuristicLab.Services.Hive.DataAccess { 
    27   public class TransactionManager : ITransactionManager {   
     25namespace HeuristicLab.Services.Hive.DataAccess {
     26  public class TransactionManager : ITransactionManager {
    2827    public void UseTransaction(Action call, bool serializable = false, bool longRunning = false) {
    2928      int n = 10;
    3029      while (n > 0) {
    31         TransactionScope transaction = CreateTransaction(serializable, longRunning);
     30        //TransactionScope transaction = CreateTransaction(serializable, longRunning);
    3231        try {
    3332          call();
    34           transaction.Complete();
     33          //transaction.Complete();
    3534          n = 0;
    3635        }
    3736        catch (System.Data.SqlClient.SqlException e) {
    3837          n--; // probably deadlock situation, let it roll back and repeat the transaction n times
    39           LogFactory.GetLogger(typeof(TransactionManager).Namespace).Log(string.Format("Exception occured, repeating transaction {0} more times. Details: {1}", n, e.ToString()));         
     38          LogFactory.GetLogger(typeof(TransactionManager).Namespace).Log(string.Format("Exception occured, repeating transaction {0} more times. Details: {1}", n, e.ToString()));
    4039          if (n <= 0) throw;
    4140        }
    4241        finally {
    43           transaction.Dispose();
     42          //transaction.Dispose();
    4443        }
    4544      }
     
    4948      int n = 10;
    5049      while (n > 0) {
    51         TransactionScope transaction = CreateTransaction(serializable, longRunning);
     50        //TransactionScope transaction = CreateTransaction(serializable, longRunning);
    5251        try {
    5352          T result = call();
    54           transaction.Complete();
     53          //transaction.Complete();
    5554          n = 0;
    5655          return result;
     
    6261        }
    6362        finally {
    64           transaction.Dispose();
     63          //transaction.Dispose();
    6564        }
    6665      }
Note: See TracChangeset for help on using the changeset viewer.