Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WF / RunTime / DbRetry.cs / 1305376 / DbRetry.cs
using System; using System.Collections.Generic; using System.Text; using System.Threading; namespace System.Workflow.Runtime { internal class DbRetry { private const short _defaultMaxRetries = 20; private const int _defaultRetrySleep = 2000; private const short _spinCount = 3; private short _maxRetries = _defaultMaxRetries; private int _retrySleep = _defaultRetrySleep; private bool _enableRetries = false; protected DbRetry() { } internal DbRetry(bool enableRetries) { _enableRetries = enableRetries; } internal short MaxRetries { get { return _maxRetries; } } internal bool TryDoRetry(ref short retryCount) { if (CanRetry(retryCount++)) { RetrySleep(retryCount); return true; } else return false; } internal bool CanRetry(short retryCount) { if (!_enableRetries) return false; if (retryCount < _maxRetries) return true; else return false; } internal void RetrySleep(short retryCount) { // // For the first couple of retries just spin // If we fail _spinCount times start then introduce a sleep if (retryCount <= _spinCount) return; int sleep = _retrySleep * retryCount; Thread.Sleep(sleep); } } } // 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
- XamlBrushSerializer.cs
- SQLByteStorage.cs
- FontNamesConverter.cs
- FrameworkContentElement.cs
- streamingZipPartStream.cs
- SiteIdentityPermission.cs
- Pen.cs
- ConfigurationLockCollection.cs
- TCPListener.cs
- EntityDataSourceChangingEventArgs.cs
- MissingSatelliteAssemblyException.cs
- activationcontext.cs
- VoiceInfo.cs
- BitmapCache.cs
- SourceSwitch.cs
- RuntimeResourceSet.cs
- DynamicValueConverter.cs
- DesignSurfaceCollection.cs
- FtpRequestCacheValidator.cs
- Emitter.cs
- QilGeneratorEnv.cs
- FontWeights.cs
- CodeParameterDeclarationExpression.cs
- ObjectSelectorEditor.cs
- TextEditorThreadLocalStore.cs
- BCryptSafeHandles.cs
- FileStream.cs
- ThreadExceptionDialog.cs
- ScalarOps.cs
- SqlDataReaderSmi.cs
- SafeNativeMethodsMilCoreApi.cs
- TableDetailsRow.cs
- ProcessProtocolHandler.cs
- TimeZone.cs
- Typeface.cs
- Content.cs
- ActivationService.cs
- ProxyFragment.cs
- ping.cs
- ErrorTableItemStyle.cs
- EpmSourceTree.cs
- WrappingXamlSchemaContext.cs
- SafeCertificateStore.cs
- FixedSOMFixedBlock.cs
- QilList.cs
- SqlUtil.cs
- AppSettingsSection.cs
- EventItfInfo.cs
- EventLogLink.cs
- GlyphRunDrawing.cs
- CfgParser.cs
- InertiaTranslationBehavior.cs
- PhysicalOps.cs
- SchemaImporterExtensionElement.cs
- OptimizerPatterns.cs
- ProfileBuildProvider.cs
- DataControlButton.cs
- TextSchema.cs
- FixedTextPointer.cs
- LinqDataSourceDisposeEventArgs.cs
- SpellerError.cs
- GACIdentityPermission.cs
- SoapHeaderException.cs
- DisplayToken.cs
- LogicalTreeHelper.cs
- AtomServiceDocumentSerializer.cs
- XmlWrappingWriter.cs
- UidPropertyAttribute.cs
- ProtocolsConfigurationHandler.cs
- SqlProcedureAttribute.cs
- ImplicitInputBrush.cs
- XPathPatternBuilder.cs
- DataControlCommands.cs
- Timer.cs
- KeyTimeConverter.cs
- TypeSystem.cs
- COM2IVsPerPropertyBrowsingHandler.cs
- WhiteSpaceTrimStringConverter.cs
- NativeRightsManagementAPIsStructures.cs
- HyperLinkDesigner.cs
- FrugalList.cs
- SqlDataSourceDesigner.cs
- AccessDataSourceView.cs
- TabControl.cs
- ColorContext.cs
- DictionaryGlobals.cs
- CollectionsUtil.cs
- XmlILConstructAnalyzer.cs
- _AutoWebProxyScriptHelper.cs
- LogEntryHeaderDeserializer.cs
- RegionIterator.cs
- HwndStylusInputProvider.cs
- SimpleFileLog.cs
- SqlXmlStorage.cs
- CustomWebEventKey.cs
- PropertyDescriptorComparer.cs
- AssemblyInfo.cs
- SamlAuthorityBinding.cs
- MemoryFailPoint.cs
- TwoPhaseCommitProxy.cs