TwoPhaseCommitProxy.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / TransactionBridge / Microsoft / Transactions / Wsat / Messaging / TwoPhaseCommitProxy.cs / 1 / TwoPhaseCommitProxy.cs

                            //------------------------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------------------------

// Define the interfaces and infrastructure needed to send 2PC messages 

using System; 
 
using System.ServiceModel.Channels;
 
using System.ServiceModel;
using System.Transactions;
using Microsoft.Transactions.Wsat.Protocol;
 
namespace Microsoft.Transactions.Wsat.Messaging
{ 
    class TwoPhaseCommitCoordinatorProxy : DatagramProxy 
    {
        public TwoPhaseCommitCoordinatorProxy(CoordinationService coordination, 
                                              EndpointAddress to,
                                              EndpointAddress from)
            :
            base(coordination, to, from) { } 

        public IAsyncResult BeginSendPrepared(AsyncCallback callback, object state) 
        { 
            Message message = new PreparedMessage(this.messageVersion, this.protocolVersion);
            return BeginSendMessage(message, callback, state); 
        }

        public IAsyncResult BeginSendReadOnly(AsyncCallback callback, object state)
        { 
            Message message = new ReadOnlyMessage(this.messageVersion, this.protocolVersion);
            return BeginSendMessage(message, callback, state); 
        } 

        public IAsyncResult BeginSendCommitted(AsyncCallback callback, object state) 
        {
            Message message = new CommittedMessage(this.messageVersion, this.protocolVersion);
            return BeginSendMessage(message, callback, state);
        } 

        public IAsyncResult BeginSendAborted(AsyncCallback callback, object state) 
        { 
            Message message = new AbortedMessage(this.messageVersion, this.protocolVersion);
            return BeginSendMessage(message, callback, state); 
        }

        public IAsyncResult BeginSendRecoverMessage(AsyncCallback callback, object state)
        { 
            Message message = NotificationMessage.CreateRecoverMessage(this.messageVersion, this.protocolVersion);
            return BeginSendMessage(message, callback, state); 
        } 
    }
 
    class TwoPhaseCommitParticipantProxy : DatagramProxy
    {
        public TwoPhaseCommitParticipantProxy (CoordinationService coordination,
                                               EndpointAddress to, 
                                               EndpointAddress from)
            : 
            base(coordination, to, from) { } 

        public IAsyncResult BeginSendPrepare(AsyncCallback callback, object state) 
        {
            Message message = new PrepareMessage(this.messageVersion, this.protocolVersion);
            return BeginSendMessage(message, callback, state);
        } 

        public IAsyncResult BeginSendCommit(AsyncCallback callback, object state) 
        { 
            Message message = new CommitMessage(this.messageVersion, this.protocolVersion);
            return BeginSendMessage(message, callback, state); 
        }

        public IAsyncResult BeginSendRollback(AsyncCallback callback, object state)
        { 
            Message message = new RollbackMessage(this.messageVersion, this.protocolVersion);
            return BeginSendMessage(message, callback, state); 
        } 
    }
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.


                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK