Example #1
0
 public CreateInstanceAsyncResult(SbmpResourceManager.TransactionEnlistment owner, TimeSpan timeout, AsyncCallback callback, object state) : base(timeout, callback, state)
 {
     this.owner = owner;
     SbmpResourceManager.TransactionEnlistment.CreateInstanceAsyncResult createInstanceAsyncResult = this;
     createInstanceAsyncResult.OnCompleting = (Action <AsyncResult, Exception>)Delegate.Combine(createInstanceAsyncResult.OnCompleting, SbmpResourceManager.TransactionEnlistment.CreateInstanceAsyncResult.Finally);
     base.Start();
 }
Example #2
0
            public EnlistAsyncResult(SbmpResourceManager resourceManager, Transaction transaction, IRequestSessionChannel channel, SbmpMessageCreator messageCreator, Action <RequestInfo> partitionInfoSetter, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state)
            {
                if (transaction.IsolationLevel != IsolationLevel.Serializable)
                {
                    throw Microsoft.ServiceBus.Messaging.FxTrace.Exception.AsError(new InvalidOperationException(SRClient.IsolationLevelNotSupported), null);
                }
                string localIdentifier = transaction.TransactionInformation.LocalIdentifier;

                lock (resourceManager.syncRoot)
                {
                    if (!resourceManager.enlistmentMap.TryGetValue(localIdentifier, out this.transactionEnlistment))
                    {
                        this.transactionEnlistment = new SbmpResourceManager.TransactionEnlistment(transaction, resourceManager, channel, messageCreator, partitionInfoSetter);
                        resourceManager.enlistmentMap.Add(localIdentifier, this.transactionEnlistment);
                        if (!transaction.EnlistPromotableSinglePhase(this.transactionEnlistment))
                        {
                            resourceManager.enlistmentMap.Remove(localIdentifier);
                            throw Microsoft.ServiceBus.Messaging.FxTrace.Exception.AsError(new InvalidOperationException(SRClient.MultipleResourceManagersNotSupported), null);
                        }
                    }
                }
                this.sequenceNumber = this.transactionEnlistment.GetNextSequenceNumber();
                if (base.SyncContinue(this.transactionEnlistment.BeginGetInstance(timeout, base.PrepareAsyncCompletion(SbmpResourceManager.EnlistAsyncResult.getInstanceComplete), this)))
                {
                    base.Complete(true);
                }
            }
Example #3
0
 public CompleteTransactionHelper(SbmpResourceManager.TransactionEnlistment transactionEnlistment, SinglePhaseEnlistment singlePhaseEnlistment, bool commit)
 {
     this.transactionEnlistment = transactionEnlistment;
     this.singlePhaseEnlistment = singlePhaseEnlistment;
     this.commit = commit;
 }