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
- GradientStop.cs
- RadioButton.cs
- loginstatus.cs
- WindowsRegion.cs
- HttpCapabilitiesBase.cs
- PrintingPermission.cs
- CharAnimationUsingKeyFrames.cs
- SafeThemeHandle.cs
- CodeTypeMemberCollection.cs
- GeneratedCodeAttribute.cs
- TableLayoutSettingsTypeConverter.cs
- DocumentPageTextView.cs
- DataGridViewTopLeftHeaderCell.cs
- SerializationEventsCache.cs
- EndEvent.cs
- ResourcesBuildProvider.cs
- Mapping.cs
- DocumentGridContextMenu.cs
- HMACSHA1.cs
- CollectionConverter.cs
- Ipv6Element.cs
- _DomainName.cs
- DynamicField.cs
- GetIsBrowserClientRequest.cs
- SmiGettersStream.cs
- TableDetailsRow.cs
- OpCopier.cs
- GenerateTemporaryTargetAssembly.cs
- WebPartCollection.cs
- NetCodeGroup.cs
- Compiler.cs
- SByteConverter.cs
- HttpListener.cs
- PassportPrincipal.cs
- Tuple.cs
- ImageSourceConverter.cs
- DynamicQueryableWrapper.cs
- DataGridViewCellLinkedList.cs
- HostedHttpRequestAsyncResult.cs
- XmlCharCheckingWriter.cs
- WebEventTraceProvider.cs
- ChangePassword.cs
- StackBuilderSink.cs
- MarshalByValueComponent.cs
- DataGridCommandEventArgs.cs
- IODescriptionAttribute.cs
- ColumnMapVisitor.cs
- XPathSelfQuery.cs
- PropertyGeneratedEventArgs.cs
- StatusBar.cs
- LOSFormatter.cs
- AlternateViewCollection.cs
- ISessionStateStore.cs
- ScalarType.cs
- ConfigXmlComment.cs
- Icon.cs
- DetailsView.cs
- FormsAuthenticationTicket.cs
- CharStorage.cs
- TreeNodeCollection.cs
- MenuAdapter.cs
- Condition.cs
- Char.cs
- DatatypeImplementation.cs
- ProxyWebPartManager.cs
- XmlWrappingWriter.cs
- PositiveTimeSpanValidator.cs
- IteratorFilter.cs
- DropDownHolder.cs
- Models.cs
- CaseExpr.cs
- CodePropertyReferenceExpression.cs
- SizeAnimationClockResource.cs
- WebZoneDesigner.cs
- OracleCommandBuilder.cs
- FlowLayoutSettings.cs
- EventManager.cs
- Parallel.cs
- IArgumentProvider.cs
- ServiceDescription.cs
- ReadOnlyPropertyMetadata.cs
- PerformanceCounterPermissionEntry.cs
- MasterPage.cs
- CustomAttributeBuilder.cs
- ConcurrentStack.cs
- WSDualHttpBindingElement.cs
- SerializationInfo.cs
- invalidudtexception.cs
- securitymgrsite.cs
- TraceContextRecord.cs
- EntityDataSourceColumn.cs
- SchemaTableOptionalColumn.cs
- HScrollBar.cs
- DialogWindow.cs
- TreeNodeCollection.cs
- BackgroundFormatInfo.cs
- AbandonedMutexException.cs
- ArgumentException.cs
- VolatileResourceManager.cs
- BaseAddressPrefixFilterElement.cs