public VolatileTwoPhaseCommitCoordinatorEvent(VolatileCoordinatorEnlistment coordinator) : base(coordinator)
 {
     MessageHeaders incomingMessageHeaders = OperationContext.Current.IncomingMessageHeaders;
     this.faultTo = Library.GetFaultToHeader(incomingMessageHeaders, base.state.ProtocolVersion);
     this.replyTo = Library.GetReplyToHeader(incomingMessageHeaders);
     this.messageID = incomingMessageHeaders.MessageId;
 }
Exemplo n.º 2
0
        public void OnEnlistPrePrepare(TmEnlistPrePrepareEvent e)
        {
            this.enlistPrePrepareEvent = e;
            if (this.volatileCoordinators == null)
            {
                this.volatileCoordinators = new List <VolatileCoordinatorEnlistment>();
            }
            VolatileCoordinatorEnlistment item = new VolatileCoordinatorEnlistment(base.state, this);

            this.volatileCoordinators.Add(item);
            base.state.Lookup.AddEnlistment(item);
            if (this.registerVolatileCoordinator != null)
            {
                Microsoft.Transactions.Bridge.DiagnosticUtility.FailFast("Duplicate EnlistPrePrepare from TM");
            }
            this.registerVolatileCoordinator = item;
        }
 public MsgVolatilePrepareEvent(VolatileCoordinatorEnlistment coordinator) : base(coordinator)
 {
 }
 public MsgRegisterVolatileResponseEvent(VolatileCoordinatorEnlistment volatileCoordinator, RegisterResponse response, TwoPhaseCommitCoordinatorProxy proxy) : base(volatileCoordinator, response, proxy)
 {
     this.volatileCoordinator = volatileCoordinator;
 }
 protected VolatileCoordinatorEvent(VolatileCoordinatorEnlistment coordinator) : base(coordinator)
 {
     this.coordinator = coordinator;
 }
 public MsgVolatileRollbackEvent(VolatileCoordinatorEnlistment coordinator) : base(coordinator)
 {
 }
 private void OnVolatileSendComplete(IAsyncResult ar, VolatileCoordinatorEnlistment volatileCoordinator)
 {
     Exception exception = null;
     try
     {
         volatileCoordinator.CoordinatorProxy.EndSendMessage(ar);
     }
     catch (WsatSendFailureException exception2)
     {
         Microsoft.Transactions.Bridge.DiagnosticUtility.ExceptionUtility.TraceHandledException(exception2, TraceEventType.Warning);
         DebugTrace.TraceSendFailure(volatileCoordinator.EnlistmentId, exception2);
         this.state.Perf.MessageSendFailureCountPerInterval.Increment();
         exception = exception2;
     }
     if (exception != null)
     {
         volatileCoordinator.StateMachine.Enqueue(new MsgVolatileCoordinatorSendFailureEvent(volatileCoordinator));
     }
 }
 public void SendVolatileRegister(VolatileCoordinatorEnlistment volatileCoordinator)
 {
     this.SendRegister(volatileCoordinator.Coordinator, ControlProtocol.Volatile2PC, volatileCoordinator.ParticipantService, this.sendVolatileRegisterComplete, volatileCoordinator);
 }
 public TmPrePrepareResponseEvent(VolatileCoordinatorEnlistment coordinator, Status status) : base(coordinator, status)
 {
 }
 public MsgVolatileCoordinatorSendFailureEvent(VolatileCoordinatorEnlistment coordinator) : base(coordinator)
 {
 }
 public void PrePrepare(VolatileCoordinatorEnlistment volatileCoordinator)
 {
     if (DebugTrace.Info)
     {
         DebugTrace.TxTrace(TraceLevel.Info, volatileCoordinator.EnlistmentId, "Sending PrePrepare to transaction manager");
     }
     this.coordination.PrePrepare(volatileCoordinator.Enlistment, this.prePrepareResponseCallback, volatileCoordinator);
 }
 protected VolatileCoordinatorFaultEvent(VolatileCoordinatorEnlistment coordinator, MessageFault fault) : base(coordinator)
 {
     this.fault = fault;
 }
 public void SendVolatileReadOnly(VolatileCoordinatorEnlistment coordinator)
 {
     if (DebugTrace.Info)
     {
         DebugTrace.TxTrace(TraceLevel.Info, coordinator.EnlistmentId, "Sending ReadOnly to volatile coordinator at {0}", Ports.TryGetAddress(coordinator.CoordinatorProxy));
     }
     IAsyncResult ar = coordinator.CoordinatorProxy.BeginSendReadOnly(this.volatileSendComplete, coordinator);
     if (ar.CompletedSynchronously)
     {
         this.OnVolatileSendComplete(ar, coordinator);
     }
 }
 private bool CheckMessage(Message message, bool fault, out CoordinatorEnlistment durableCoordinator, out VolatileCoordinatorEnlistment volatileCoordinator)
 {
     Guid guid;
     TwoPhaseCommitCoordinatorProxy coordinatorProxy;
     durableCoordinator = null;
     volatileCoordinator = null;
     if (!Ports.TryGetEnlistment(message, out guid))
     {
         DebugTrace.Trace(TraceLevel.Warning, "Could not read enlistment header from message");
         if (fault)
         {
             this.SendFault(message, this.state.Faults.InvalidParameters);
         }
         return false;
     }
     Microsoft.Transactions.Wsat.Protocol.TransactionEnlistment enlistment = this.state.Lookup.FindEnlistment(guid);
     if (enlistment == null)
     {
         DebugTrace.Trace(TraceLevel.Warning, "Could not find enlistment {0}", guid);
         return true;
     }
     durableCoordinator = enlistment as CoordinatorEnlistment;
     if (durableCoordinator == null)
     {
         volatileCoordinator = enlistment as VolatileCoordinatorEnlistment;
         if (volatileCoordinator == null)
         {
             DebugTrace.Trace(TraceLevel.Warning, "2PC message received for non-2PC enlistment {0}", guid);
             if (fault)
             {
                 this.SendFault(message, this.state.Faults.InvalidParameters);
             }
             return false;
         }
         coordinatorProxy = volatileCoordinator.CoordinatorProxy;
     }
     else
     {
         coordinatorProxy = durableCoordinator.CoordinatorProxy;
     }
     if (coordinatorProxy == null)
     {
         if ((durableCoordinator != null) && object.ReferenceEquals(durableCoordinator.StateMachine.State, this.state.States.CoordinatorFailedRecovery))
         {
             DebugTrace.TxTrace(TraceLevel.Warning, enlistment.EnlistmentId, "Coordinator enlistment was not correctly recovered");
             if (fault)
             {
                 this.SendFault(message, this.state.Faults.InvalidPolicy);
             }
             return false;
         }
         if (DebugTrace.Warning)
         {
             DebugTrace.TxTrace(TraceLevel.Warning, enlistment.EnlistmentId, "Received premature message with action {0}", message.Headers.Action);
         }
         if (fault)
         {
             this.SendFault(message, this.state.Faults.InvalidState);
         }
         return false;
     }
     if (this.state.Service.Security.CheckIdentity(coordinatorProxy, message))
     {
         return true;
     }
     if (EnlistmentIdentityCheckFailedRecord.ShouldTrace)
     {
         EnlistmentIdentityCheckFailedRecord.Trace(enlistment.EnlistmentId);
     }
     return false;
 }
 protected VolatileCoordinatorStatusEvent(VolatileCoordinatorEnlistment coordinator, Microsoft.Transactions.Bridge.Status status) : base(coordinator)
 {
     this.status = status;
 }
 public MsgVolatileCoordinatorFaultEvent(VolatileCoordinatorEnlistment coordinator, MessageFault fault) : base(coordinator, fault)
 {
 }
 public MsgVolatileCommitEvent(VolatileCoordinatorEnlistment coordinator) : base(coordinator)
 {
 }
 protected void TrySendAborted(VolatileCoordinatorEnlistment coordinator)
 {
     if (coordinator.CoordinatorProxy != null)
     {
         this.state.TwoPhaseCommitParticipant.SendVolatileAborted(coordinator);
     }
 }
 public void OnEnlistPrePrepare(TmEnlistPrePrepareEvent e)
 {
     this.enlistPrePrepareEvent = e;
     if (this.volatileCoordinators == null)
     {
         this.volatileCoordinators = new List<VolatileCoordinatorEnlistment>();
     }
     VolatileCoordinatorEnlistment item = new VolatileCoordinatorEnlistment(base.state, this);
     this.volatileCoordinators.Add(item);
     base.state.Lookup.AddEnlistment(item);
     if (this.registerVolatileCoordinator != null)
     {
         Microsoft.Transactions.Bridge.DiagnosticUtility.FailFast("Duplicate EnlistPrePrepare from TM");
     }
     this.registerVolatileCoordinator = item;
 }