Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / TransactionBridge / Microsoft / Transactions / Wsat / StateMachines / Subordinate.cs / 1 / Subordinate.cs
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
// This file contains the the implementations of the various states used by the
// Subordinate state machine, which handles incoming activation and registration events
// for transactions with DTC as superior and no WS-AT coordinator.
//
// This is a somewhat special state machine, in that it has no "active" states
using System;
using System.Diagnostics;
using Microsoft.Transactions.Bridge;
using Microsoft.Transactions.Wsat.Messaging;
using Microsoft.Transactions.Wsat.InputOutput;
using Microsoft.Transactions.Wsat.Protocol;
using Fault = Microsoft.Transactions.Wsat.Messaging.Fault;
namespace Microsoft.Transactions.Wsat.StateMachines
{
//=============================================================================
// SubordinateInitializing
//
// A CreateCoordinationContext message was received
// DTC already knew about the transaction, so we can't be superior to DTC
// We will therefore be subordinate to DTC for the transaction
//=============================================================================
class SubordinateInitializing : InactiveState
{
public SubordinateInitializing(ProtocolState state) : base(state) { }
public override void OnEvent(InternalEnlistSubordinateTransactionEvent e)
{
ParticipantEnlistment participant = e.Participant;
state.TransactionManagerSend.Register(participant, e);
participant.StateMachine.ChangeState(state.States.SubordinateRegistering);
}
}
//==============================================================================
// SubordinateRegistering
//
// We asked the TM to create a new subordinate enlistment
//=============================================================================
class SubordinateRegistering : InactiveState
{
public SubordinateRegistering(ProtocolState state) : base(state) { }
public override void OnEvent(TmSubordinateRegisterResponseEvent e)
{
ParticipantEnlistment participant = e.Participant;
Status status = e.Status;
if (status == Status.Success)
{
participant.OnSubordinateRegistered();
participant.StateMachine.ChangeState(state.States.SubordinateActive);
}
else
{
if (status == Status.TransactionNotFound &&
!state.TransactionManager.Settings.NetworkInboundAccess)
{
participant.ContextManager.Fault = this.state.Faults.SubordinateRegistrationNetAccessDisabled;
}
else
{
participant.ContextManager.Fault = this.state.Faults.SubordinateTMRegistrationFailed(status);
}
participant.StateMachine.ChangeState(state.States.SubordinateFinished);
}
}
}
//==============================================================================
// SubordinateActive
//
// A dummy subordinate was created for the enlistment
// We await news from the transaction manager
//==============================================================================
class SubordinateActive : InactiveState
{
public SubordinateActive(ProtocolState state) : base(state) { }
public override void OnEvent(TmPrepareEvent e)
{
ParticipantEnlistment participant = e.Participant;
participant.SetCallback(e.Callback, e.CallbackState);
state.TransactionManagerSend.ReadOnly(participant);
participant.StateMachine.ChangeState(state.States.SubordinateFinished);
}
public override void OnEvent(TmRollbackEvent e)
{
ParticipantEnlistment participant = e.Participant;
participant.SetCallback(e.Callback, e.CallbackState);
state.TransactionManagerSend.Aborted(participant);
participant.StateMachine.ChangeState(state.States.SubordinateFinished);
}
}
//=============================================================================
// SubordinateFinished
//
// The subordinate enlistment has ended
//==============================================================================
class SubordinateFinished : TerminalState
{
public SubordinateFinished(ProtocolState state) : base(state) { }
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- InputScopeAttribute.cs
- ConnectionPoint.cs
- TimeSpan.cs
- TypeBuilderInstantiation.cs
- DecoderReplacementFallback.cs
- DependsOnAttribute.cs
- UserControlParser.cs
- MultiBinding.cs
- SqlIdentifier.cs
- ConnectionModeReader.cs
- IsolatedStorageFilePermission.cs
- GenericWebPart.cs
- XmlnsDefinitionAttribute.cs
- RadioButtonRenderer.cs
- DiscardableAttribute.cs
- UserControlCodeDomTreeGenerator.cs
- MetadataCollection.cs
- ContextStack.cs
- DataGridToolTip.cs
- PenContext.cs
- ExtendedPropertyDescriptor.cs
- StateDesigner.cs
- XmlBufferReader.cs
- ChangeConflicts.cs
- EditingCoordinator.cs
- HMACRIPEMD160.cs
- CodeTypeReferenceSerializer.cs
- ObjectDataSource.cs
- TextServicesDisplayAttribute.cs
- DefaultCommandConverter.cs
- NetworkStream.cs
- SemanticKeyElement.cs
- RegexRunnerFactory.cs
- securestring.cs
- ColumnWidthChangingEvent.cs
- BitmapEffectInput.cs
- PropertyChangeTracker.cs
- _Semaphore.cs
- MediaEntryAttribute.cs
- IPEndPointCollection.cs
- Win32Native.cs
- ActivityExecutorSurrogate.cs
- WeakKeyDictionary.cs
- SqlServices.cs
- CodeCommentStatementCollection.cs
- CompoundFileIOPermission.cs
- Random.cs
- DetailsViewRowCollection.cs
- ConfigurationSectionCollection.cs
- DisplayMemberTemplateSelector.cs
- WebPartEditorApplyVerb.cs
- cookiecontainer.cs
- ObjectDataSourceSelectingEventArgs.cs
- CodePropertyReferenceExpression.cs
- RequestResizeEvent.cs
- QueryTaskGroupState.cs
- WebContext.cs
- PrintPageEvent.cs
- TrailingSpaceComparer.cs
- BamlWriter.cs
- Themes.cs
- XmlDataSourceView.cs
- TextModifier.cs
- PrintPreviewDialog.cs
- RegexCode.cs
- MergeFilterQuery.cs
- SingleBodyParameterMessageFormatter.cs
- CodeAttributeArgumentCollection.cs
- EndGetFileNameFromUserRequest.cs
- DeferrableContent.cs
- ParamArrayAttribute.cs
- DiscoveryClientOutputChannel.cs
- EntityDataSourceContextDisposingEventArgs.cs
- HyperLinkField.cs
- BaseInfoTable.cs
- ShapingWorkspace.cs
- FixedDocument.cs
- Utils.cs
- TripleDES.cs
- CacheMemory.cs
- XmlHelper.cs
- EmptyEnumerable.cs
- TextDocumentView.cs
- CallbackBehaviorAttribute.cs
- DirectionalLight.cs
- OperatorExpressions.cs
- TraceLevelStore.cs
- RuntimeHelpers.cs
- MetadataItemSerializer.cs
- SamlAssertionKeyIdentifierClause.cs
- AssemblyInfo.cs
- SqlFormatter.cs
- GradientPanel.cs
- ComplexPropertyEntry.cs
- EntityDataSourceWrapper.cs
- IsolatedStorageFileStream.cs
- PersonalizationStateInfoCollection.cs
- SqlUtils.cs
- FamilyCollection.cs
- DynamicUpdateCommand.cs