Exemplo n.º 1
0
        public override void OnEvent(TmEnlistTransactionResponseEvent e)
        {
            CoordinatorEnlistment     coordinator = e.Coordinator;
            MsgEnlistTransactionEvent sourceEvent = e.SourceEvent;
            Status status = e.Status;

            if (status == Status.Success)
            {
                if (EnlistTransactionRecord.ShouldTrace)
                {
                    EnlistTransactionRecord.Trace(coordinator.EnlistmentId, sourceEvent.Body.CurrentContext);
                }
                coordinator.OnCoordinatorEnlisted();
                coordinator.StateMachine.ChangeState(base.state.States.CoordinatorEnlisted);
            }
            else if (status == Status.DuplicateTransaction)
            {
                base.ForwardEnlistmentEventToSubordinate(sourceEvent);
                coordinator.StateMachine.ChangeState(base.state.States.CoordinatorInitializationFailed);
            }
            else
            {
                if (EnlistTransactionFailureRecord.ShouldTrace)
                {
                    EnlistTransactionFailureRecord.Trace(coordinator.EnlistmentId, sourceEvent.Body.CurrentContext, Microsoft.Transactions.SR.GetString("PplCreateSuperiorEnlistmentFailed", new object[] { e.Status.ToString() }));
                }
                coordinator.ContextManager.Fault = base.state.Faults.TMEnlistFailed(e.Status);
                coordinator.StateMachine.ChangeState(base.state.States.CoordinatorInitializationFailed);
            }
        }
Exemplo n.º 2
0
        public override void OnEvent(MsgEnlistTransactionEvent e)
        {
            CoordinatorEnlistment coordinator = e.Coordinator;

            if (!base.state.TransactionManager.Settings.NetworkInboundAccess)
            {
                base.ForwardEnlistmentEventToSubordinate(e);
                coordinator.StateMachine.ChangeState(base.state.States.CoordinatorInitializationFailed);
            }
            else
            {
                CoordinationContext currentContext = e.Body.CurrentContext;
                RegistrationProxy   proxy          = base.state.TryCreateRegistrationProxy(currentContext.RegistrationService);
                if (proxy == null)
                {
                    coordinator.ContextManager.Fault = base.state.Faults.RegistrationProxyFailed;
                    coordinator.StateMachine.ChangeState(base.state.States.CoordinatorInitializationFailed);
                }
                else
                {
                    try
                    {
                        coordinator.SetRegistrationProxy(proxy);
                        EnlistmentOptions options = coordinator.CreateEnlistmentOptions(currentContext.Expires, currentContext.ExpiresPresent, currentContext.IsolationLevel, currentContext.IsolationFlags, currentContext.Description);
                        base.state.TransactionManagerSend.EnlistTransaction(coordinator, options, e);
                        e.StateMachine.ChangeState(base.state.States.CoordinatorEnlisting);
                    }
                    finally
                    {
                        proxy.Release();
                    }
                }
            }
        }
 protected void ForwardEnlistmentEventToSubordinate(MsgEnlistTransactionEvent e)
 {
     CoordinatorEnlistment coordinator = e.Coordinator;
     TransactionContextManager contextManager = coordinator.ContextManager;
     coordinator.ContextManager = null;
     ParticipantEnlistment participant = new ParticipantEnlistment(this.state, coordinator.Enlistment, contextManager);
     participant.StateMachine.Enqueue(new InternalEnlistSubordinateTransactionEvent(participant, e));
 }
 public override void OnEvent(TransactionContextEnlistTransactionEvent e)
 {
     e.ContextManager.Requests.Enqueue(e);
     e.StateMachine.ChangeState(base.state.States.TransactionContextInitializingCoordinator);
     CoordinatorEnlistment coordinator = new CoordinatorEnlistment(base.state, e.ContextManager, e.Body.CurrentContext, e.Body.IssuedToken);
     CreateCoordinationContext body = e.Body;
     MsgEnlistTransactionEvent event2 = new MsgEnlistTransactionEvent(coordinator, ref body, e.Result);
     coordinator.StateMachine.Enqueue(event2);
 }
Exemplo n.º 5
0
        protected void ForwardEnlistmentEventToSubordinate(MsgEnlistTransactionEvent e)
        {
            CoordinatorEnlistment     coordinator    = e.Coordinator;
            TransactionContextManager contextManager = coordinator.ContextManager;

            coordinator.ContextManager = null;
            ParticipantEnlistment participant = new ParticipantEnlistment(this.state, coordinator.Enlistment, contextManager);

            participant.StateMachine.Enqueue(new InternalEnlistSubordinateTransactionEvent(participant, e));
        }
        public override void OnEvent(TransactionContextEnlistTransactionEvent e)
        {
            e.ContextManager.Requests.Enqueue(e);
            e.StateMachine.ChangeState(base.state.States.TransactionContextInitializingCoordinator);
            CoordinatorEnlistment     coordinator = new CoordinatorEnlistment(base.state, e.ContextManager, e.Body.CurrentContext, e.Body.IssuedToken);
            CreateCoordinationContext body        = e.Body;
            MsgEnlistTransactionEvent event2      = new MsgEnlistTransactionEvent(coordinator, ref body, e.Result);

            coordinator.StateMachine.Enqueue(event2);
        }
Exemplo n.º 7
0
 public TmEnlistTransactionResponseEvent(CoordinatorEnlistment coordinator, Status status, MsgEnlistTransactionEvent e) : base(coordinator, status)
 {
     this.e = e;
 }
 public virtual void OnEvent(MsgEnlistTransactionEvent e)
 {
     throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotImplementedException());
 }
Exemplo n.º 9
0
 public virtual void OnEvent(MsgEnlistTransactionEvent e)
 {
     throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotImplementedException());
 }
 public void EnlistTransaction(CoordinatorEnlistment coordinator, EnlistmentOptions options, MsgEnlistTransactionEvent e)
 {
     DebugTrace.Trace(TraceLevel.Info, "Sending CreateSuperiorEnlistment to transaction manager");
     this.propagation.CreateSuperiorEnlistment(coordinator.Enlistment, options, this.enlistTransactionResponseCallback, e);
 }
 public InternalEnlistSubordinateTransactionEvent(ParticipantEnlistment participant, MsgEnlistTransactionEvent source) : base(participant)
 {
     this.source = source;
 }
 public void OnEvent(MsgEnlistTransactionEvent e)
 {
     DebugTrace.TxTrace(TraceLevel.Info, e.Enlistment.EnlistmentId, "{0}{1}", e, (e.Body.IssuedToken != null) ? " with issued token" : string.Empty);
 }
 public TmEnlistTransactionResponseEvent(CoordinatorEnlistment coordinator, Status status, MsgEnlistTransactionEvent e) : base(coordinator, status)
 {
     this.e = e;
 }
Exemplo n.º 14
0
 public InternalEnlistSubordinateTransactionEvent(ParticipantEnlistment participant, MsgEnlistTransactionEvent source) : base(participant)
 {
     this.source = source;
 }