Exemplo n.º 1
0
 public void SendReadOnly(EndpointAddress sendTo)
 {
     if (sendTo != null)
     {
         TwoPhaseCommitCoordinatorProxy proxy = this.state.TryCreateTwoPhaseCommitCoordinatorProxy(sendTo);
         if (proxy != null)
         {
             try
             {
                 if (DebugTrace.Info)
                 {
                     DebugTrace.Trace(TraceLevel.Info, "Sending ReadOnly to unrecognized participant at {0}", Ports.TryGetAddress(proxy));
                 }
                 IAsyncResult ar = proxy.BeginSendReadOnly(this.politeSendComplete, proxy);
                 if (ar.CompletedSynchronously)
                 {
                     this.OnPoliteSendComplete(ar, proxy);
                 }
             }
             finally
             {
                 proxy.Release();
             }
         }
     }
 }
Exemplo n.º 2
0
        private void OnSendRegisterComplete(CoordinatorEnlistment coordinator, ControlProtocol protocol, IAsyncResult ar)
        {
            SynchronizationEvent event2;
            EndpointAddress      to = null;

            try
            {
                RegisterResponse response = coordinator.RegistrationProxy.EndSendRegister(ar);
                to = response.CoordinatorProtocolService;
                TwoPhaseCommitCoordinatorProxy proxy = this.state.TryCreateTwoPhaseCommitCoordinatorProxy(to);
                if (proxy == null)
                {
                    if (RegistrationCoordinatorResponseInvalidMetadataRecord.ShouldTrace)
                    {
                        RegistrationCoordinatorResponseInvalidMetadataRecord.Trace(coordinator.EnlistmentId, coordinator.SuperiorContext, protocol, to, null, this.state.ProtocolVersion);
                    }
                    event2 = new MsgRegistrationCoordinatorSendFailureEvent(coordinator);
                }
                else
                {
                    try
                    {
                        if (protocol == ControlProtocol.Durable2PC)
                        {
                            event2 = new MsgRegisterDurableResponseEvent(coordinator, response, proxy);
                        }
                        else
                        {
                            VolatileCoordinatorEnlistment asyncState = (VolatileCoordinatorEnlistment)ar.AsyncState;
                            event2 = new MsgRegisterVolatileResponseEvent(asyncState, response, proxy);
                        }
                    }
                    finally
                    {
                        proxy.Release();
                    }
                }
            }
            catch (WsatFaultException exception)
            {
                Microsoft.Transactions.Bridge.DiagnosticUtility.ExceptionUtility.TraceHandledException(exception, TraceEventType.Warning);
                event2 = new MsgRegistrationCoordinatorFaultEvent(coordinator, protocol, exception.Fault);
                if (RegistrationCoordinatorFaultedRecord.ShouldTrace)
                {
                    RegistrationCoordinatorFaultedRecord.Trace(coordinator.EnlistmentId, coordinator.SuperiorContext, protocol, exception.Fault);
                }
            }
            catch (WsatMessagingException exception2)
            {
                Microsoft.Transactions.Bridge.DiagnosticUtility.ExceptionUtility.TraceHandledException(exception2, TraceEventType.Warning);
                this.state.Perf.MessageSendFailureCountPerInterval.Increment();
                if (RegistrationCoordinatorFailedRecord.ShouldTrace)
                {
                    RegistrationCoordinatorFailedRecord.Trace(coordinator.EnlistmentId, coordinator.SuperiorContext, protocol, exception2);
                }
                DebugTrace.TraceSendFailure(coordinator.EnlistmentId, exception2);
                event2 = new MsgRegistrationCoordinatorSendFailureEvent(coordinator);
            }
            coordinator.StateMachine.Enqueue(event2);
        }