Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.Activities.DurableInstancing / System / Activities / DurableInstancing / InstanceLockTracking.cs / 1305376 / InstanceLockTracking.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.Activities.DurableInstancing { using System.Runtime.DurableInstancing; using System.Transactions; sealed class InstanceLockTracking { object synchLock; SqlWorkflowInstanceStore store; public InstanceLockTracking(SqlWorkflowInstanceStore store) { this.InstanceId = Guid.Empty; this.store = store; this.synchLock = new object(); } public Guid InstanceId { get; set; } public bool BoundToLock { get; set; } public long InstanceVersion { get; set; } public bool IsHandleFreed { get; set; } public bool IsSafeToUnlock { get; set; } public void HandleFreed() { lock (this.synchLock) { if (this.BoundToLock && this.IsSafeToUnlock) { this.store.GenerateUnlockCommand(this); } this.IsHandleFreed = true; } } public void TrackStoreLock(Guid instanceId, long instanceVersion, DependentTransaction dependentTransaction) { this.BoundToLock = true; this.InstanceId = instanceId; this.InstanceVersion = instanceVersion; if (dependentTransaction != null) { dependentTransaction.TransactionCompleted += new TransactionCompletedEventHandler(TransactionCompleted); } else { this.IsSafeToUnlock = true; } } public void TrackStoreUnlock(DependentTransaction dependentTransaction) { this.BoundToLock = false; this.IsHandleFreed = true; if (dependentTransaction != null) { dependentTransaction.TransactionCompleted += new TransactionCompletedEventHandler(TransactedUnlockCompleted); } } void TransactionCompleted(object sender, TransactionEventArgs e) { lock (this.synchLock) { if (e.Transaction.TransactionInformation.Status == TransactionStatus.Committed) { if (this.IsHandleFreed) { this.store.GenerateUnlockCommand(this); } else { this.IsSafeToUnlock = true; } } else { this.BoundToLock = false; } } } void TransactedUnlockCompleted(object sender, TransactionEventArgs e) { lock (this.synchLock) { if (e.Transaction.TransactionInformation.Status != TransactionStatus.Committed && this.IsSafeToUnlock) { this.store.GenerateUnlockCommand(this); } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- AppliedDeviceFiltersDialog.cs
- XmlDictionary.cs
- SqlXml.cs
- input.cs
- FixedDocumentPaginator.cs
- Profiler.cs
- PageFunction.cs
- DetailsViewUpdateEventArgs.cs
- TCPListener.cs
- BaseComponentEditor.cs
- ViewStateModeByIdAttribute.cs
- ViewKeyConstraint.cs
- MessageDispatch.cs
- PathNode.cs
- MouseGestureConverter.cs
- DataGridHelper.cs
- GeometryDrawing.cs
- DropShadowEffect.cs
- OAVariantLib.cs
- DataGridCell.cs
- NavigationPropertyEmitter.cs
- CustomSignedXml.cs
- columnmapfactory.cs
- Pens.cs
- CodeEventReferenceExpression.cs
- UnsafePeerToPeerMethods.cs
- WinFormsComponentEditor.cs
- DeploymentSection.cs
- FirstMatchCodeGroup.cs
- InvalidWMPVersionException.cs
- Geometry3D.cs
- WasEndpointConfigContainer.cs
- SystemIPInterfaceProperties.cs
- PropertyChangingEventArgs.cs
- CodeMemberField.cs
- AuthorizationRule.cs
- KeyMatchBuilder.cs
- ProjectedSlot.cs
- MD5.cs
- StringTraceRecord.cs
- FloaterParagraph.cs
- TableLayoutSettingsTypeConverter.cs
- ObservableDictionary.cs
- SpanIndex.cs
- XmlSchemaInferenceException.cs
- ManagementScope.cs
- EdmFunctionAttribute.cs
- Hashtable.cs
- SafeFileHandle.cs
- WithParamAction.cs
- AdvancedBindingEditor.cs
- Lasso.cs
- ObjectDataSourceSelectingEventArgs.cs
- Durable.cs
- PageThemeCodeDomTreeGenerator.cs
- StorageBasedPackageProperties.cs
- DrawingContextWalker.cs
- DataViewSetting.cs
- XmlQualifiedNameTest.cs
- PeerNodeAddress.cs
- TextServicesManager.cs
- PortCache.cs
- DependencyObject.cs
- MemberJoinTreeNode.cs
- _CacheStreams.cs
- DateTimeStorage.cs
- StyleConverter.cs
- HttpFileCollection.cs
- InputLanguageManager.cs
- ContainerActivationHelper.cs
- HotSpot.cs
- WaitForChangedResult.cs
- ListControlBuilder.cs
- Compress.cs
- PasswordRecovery.cs
- SpotLight.cs
- ValidateNames.cs
- DbCommandTree.cs
- RightNameExpirationInfoPair.cs
- DeploymentSection.cs
- BufferModeSettings.cs
- ResXResourceSet.cs
- MsmqTransportElement.cs
- OleDbPropertySetGuid.cs
- util.cs
- Msmq4PoisonHandler.cs
- GeometryDrawing.cs
- SequentialUshortCollection.cs
- WindowsIPAddress.cs
- SocketException.cs
- CustomValidator.cs
- DataProtectionSecurityStateEncoder.cs
- DispatcherFrame.cs
- NamespaceListProperty.cs
- XsltSettings.cs
- RuntimeUtils.cs
- EventLogInformation.cs
- SByte.cs
- Symbol.cs
- WebPartsPersonalizationAuthorization.cs