public void ExecuteTransaction(TransactionFramework.TransactionChain transactionChain) { /// TODO: Need to figure why this is happening for the re-alignment code. /// TODO: Probably should add a warning in the debugger to indicate there is a potential performance problem if there are too many chains with empty transactions. if (transactionChain.NumOfTransactions <= 0) { return; } TransactionFramework.ISoapTransactionLinkExecutor executor = transactionChain; if (executor == null) { throw new NotSupportedException("This is not a supported type of link. This link does not implement ISoapTransactionLinkExecutor."); } lock (_executionThreadsLock) { ExecutionThreads.AddTransactionChain(transactionChain); if (_isInProcess) { executor = null; } else { ExecutionThreads.MoveToNextChain(); _isInProcess = true; } } if (MapManagerActivityStatusUpdated != null) { Proxy.MapManagerActivityEventArgs status = new Proxy.MapManagerActivityEventArgs(); status.TransactionsLeft = ExecutionThreads.Count + 1; status.Status = Proxy.ActivityStatusEnum.Busy; MapManagerActivityStatusUpdated.Invoke(this, status); } if (executor != null) { /// TODO: Remove the following TransactionFramework.TransactionChain chain = executor as TransactionFramework.TransactionChain; if (chain != null) { System.Diagnostics.Debug.WriteLine(chain.ChainId); } /// executor.TransactionFailed += OnTransactionFailed; executor.TransactionCompleted += OnTransactionCompleted; executor.ExecuteTransaction(Guid.Empty, ServiceProxy); } }
public void ExecuteTransactions(Queue <TransactionFramework.TransactionChain> chains) { TransactionFramework.TransactionChain firstChain = null; lock (_executionThreadsLock) { while (chains.Count > 0) { TransactionFramework.TransactionChain chain = chains.Dequeue(); /// TODO: Need to figure why this is happening for the re-alignment code. /// TODO: Probably should add a warning in the debugger to indicate there is a potential performance problem if there are too many chains with empty transactions. if (chain.NumOfTransactions <= 0) { continue; } if (firstChain == null) { firstChain = chain; ExecutionThreads.AddTransactionChain(firstChain); if (_isInProcess) { firstChain = null; } else { ExecutionThreads.MoveToNextChain(); _isInProcess = true; } } else { ExecutionThreads.AddTransactionChain(chain); } } } if (firstChain != null) { firstChain.TransactionFailed += OnTransactionFailed; firstChain.TransactionCompleted += OnTransactionCompleted; firstChain.ExecuteTransaction(Guid.Empty, ServiceProxy); } }