Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.Activities.DurableInstancing / System / Activities / DurableInstancing / PersistenceTask.cs / 1305376 / PersistenceTask.cs
//---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System.Activities.DurableInstancing { using System; using System.Runtime; using System.Runtime.DurableInstancing; abstract class PersistenceTask { bool automaticallyResetTimer; AsyncCallback commandCompletedCallback; InstancePersistenceCommand instancePersistenceCommand; TimeSpan taskInterval; IOThreadTimer taskTimer; object thisLock; bool timerCancelled; public PersistenceTask(SqlWorkflowInstanceStore store, SqlWorkflowInstanceStoreLock storeLock, InstancePersistenceCommand instancePersistenceCommand, TimeSpan taskInterval, bool automaticallyResetTimer) { this.automaticallyResetTimer = automaticallyResetTimer; this.commandCompletedCallback = Fx.ThunkCallback(CommandCompletedCallback); this.instancePersistenceCommand = instancePersistenceCommand; this.Store = store; this.StoreLock = storeLock; this.SurrogateLockOwnerId = this.StoreLock.SurrogateLockOwnerId; this.taskInterval = taskInterval; this.thisLock = new object(); } protected SqlWorkflowInstanceStore Store { get; set; } protected SqlWorkflowInstanceStoreLock StoreLock { get; set; } protected long SurrogateLockOwnerId { get; set; } object ThisLock { get { return this.thisLock; } } public void CancelTimer() { lock (ThisLock) { this.timerCancelled = true; if (this.taskTimer != null) { this.taskTimer.Cancel(); this.taskTimer = null; } } } public void ResetTimer(bool fireImmediately) { this.ResetTimer(fireImmediately, null); } public virtual void ResetTimer(bool fireImmediately, TimeSpan? taskIntervalOverride) { TimeSpan timeTillNextPoll = this.taskInterval; if (taskIntervalOverride.HasValue) { if (taskIntervalOverride.Value < this.taskInterval) timeTillNextPoll = taskIntervalOverride.Value; } lock (ThisLock) { if (!this.timerCancelled) { if (this.taskTimer == null) { this.taskTimer = new IOThreadTimer(new Action
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CodeTryCatchFinallyStatement.cs
- AuthenticationServiceManager.cs
- RunClient.cs
- ScriptingWebServicesSectionGroup.cs
- PersonalizationEntry.cs
- HandlerBase.cs
- PeerTransportListenAddressValidator.cs
- RetriableClipboard.cs
- ApplicationProxyInternal.cs
- BamlResourceContent.cs
- DataGridViewImageColumn.cs
- SubqueryRules.cs
- TrackingServices.cs
- DataBinding.cs
- TrimSurroundingWhitespaceAttribute.cs
- DataGridViewSelectedCellCollection.cs
- HttpServerUtilityWrapper.cs
- sortedlist.cs
- ContractValidationHelper.cs
- InputQueueChannel.cs
- Duration.cs
- SingleSelectRootGridEntry.cs
- WizardStepCollectionEditor.cs
- TreePrinter.cs
- Compilation.cs
- XmlRawWriter.cs
- Thumb.cs
- ValidationRuleCollection.cs
- OracleParameterCollection.cs
- UiaCoreApi.cs
- BooleanAnimationBase.cs
- WebBrowser.cs
- QilTernary.cs
- TextFormatterContext.cs
- dataprotectionpermission.cs
- Atom10FormatterFactory.cs
- XmlWrappingWriter.cs
- ZipIOCentralDirectoryBlock.cs
- RequestSecurityTokenResponse.cs
- InputChannelAcceptor.cs
- ClonableStack.cs
- ImageSource.cs
- SpeechUI.cs
- URLMembershipCondition.cs
- BoundField.cs
- CanonicalXml.cs
- KeyInstance.cs
- InheritablePropertyChangeInfo.cs
- PlanCompilerUtil.cs
- LifetimeServices.cs
- DataGridViewLinkCell.cs
- EntityDesignerDataSourceView.cs
- CngKey.cs
- Span.cs
- AdjustableArrowCap.cs
- ViewLoader.cs
- BezierSegment.cs
- DefaultEvaluationContext.cs
- JsonReader.cs
- GlobalProxySelection.cs
- ResolvedKeyFrameEntry.cs
- GridViewDeletedEventArgs.cs
- ConfigurationSectionGroup.cs
- SizeAnimationBase.cs
- IntegerValidatorAttribute.cs
- TabItemAutomationPeer.cs
- GeometryConverter.cs
- WindowsSspiNegotiation.cs
- OperationAbortedException.cs
- DescendantOverDescendantQuery.cs
- XmlIlGenerator.cs
- NullExtension.cs
- RSAPKCS1KeyExchangeFormatter.cs
- TriggerAction.cs
- ConstraintConverter.cs
- CalendarTable.cs
- StoryFragments.cs
- TransformConverter.cs
- _SSPIWrapper.cs
- PerfCounters.cs
- DotExpr.cs
- LoginCancelEventArgs.cs
- SoapException.cs
- SafeCancelMibChangeNotify.cs
- DataError.cs
- TracingConnection.cs
- ListViewCommandEventArgs.cs
- Cloud.cs
- Geometry.cs
- ToolStripItem.cs
- XmlHelper.cs
- FontCollection.cs
- SchemaNotation.cs
- UncommonField.cs
- DashStyle.cs
- CodeGenerator.cs
- ModuleConfigurationInfo.cs
- InfoCardRSAPKCS1KeyExchangeDeformatter.cs
- IisTraceWebEventProvider.cs
- ElapsedEventArgs.cs