Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Channels / Msmq3PoisonHandler.cs / 1 / Msmq3PoisonHandler.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Channels { using System.Collections.Generic; sealed class Msmq3PoisonHandler: IPoisonHandlingStrategy { const int maxTrackedMessages = 256; MsmqReceiveHelper receiver; SortedListtrackedMessages; object thisLock = new object(); internal Msmq3PoisonHandler(MsmqReceiveHelper receiver) { this.receiver = receiver; this.trackedMessages = new SortedList (maxTrackedMessages); } public bool CheckAndHandlePoisonMessage(MsmqMessageProperty messageProperty) { long lookupId = messageProperty.LookupId; int seen; lock (thisLock) { seen = this.UpdateSeenCount(lookupId); if (seen > (receiver.MsmqReceiveParameters.ReceiveRetryCount + 1) && receiver.MsmqReceiveParameters.ReceiveRetryCount != Int32.MaxValue) { FinalDisposition(messageProperty); this.trackedMessages.Remove(lookupId); return true; } } messageProperty.AbortCount = seen - 1; return false; } public void FinalDisposition(MsmqMessageProperty messageProperty) { switch (receiver.MsmqReceiveParameters.ReceiveErrorHandling) { case ReceiveErrorHandling.Drop: this.receiver.DropOrRejectReceivedMessage(messageProperty, false); break; case ReceiveErrorHandling.Fault: MsmqReceiveHelper.TryAbortTransactionCurrent(); if (null != this.receiver.ChannelListener) this.receiver.ChannelListener.FaultListener(); if (null != this.receiver.Channel) this.receiver.Channel.FaultChannel(); break; default: DiagnosticUtility.DebugAssert("System.ServiceModel.Channels.Msmq3PoisonHandler.FinalDisposition(): (unexpected ReceiveErrorHandling)"); break; } } int UpdateSeenCount(long lookupId) { int value; if (this.trackedMessages.TryGetValue(lookupId, out value)) { ++ value; this.trackedMessages[lookupId] = value; return value; } else { if (maxTrackedMessages == this.trackedMessages.Count) { this.trackedMessages.RemoveAt(0); } this.trackedMessages.Add(lookupId, 1); return 1; } } public void Open() {} public void Dispose() {} } } // 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
- TraceSource.cs
- SourceElementsCollection.cs
- GatewayIPAddressInformationCollection.cs
- SelectionPattern.cs
- GroupBoxRenderer.cs
- ThreadExceptionEvent.cs
- TablePattern.cs
- DocumentSchemaValidator.cs
- CachedFontFace.cs
- TcpSocketManager.cs
- ItemsControl.cs
- HandlerMappingMemo.cs
- CapabilitiesSection.cs
- RelativeSource.cs
- TableLayout.cs
- PtsHost.cs
- TypeInitializationException.cs
- QilXmlReader.cs
- WindowsListViewGroup.cs
- GregorianCalendarHelper.cs
- XmlQualifiedNameTest.cs
- ArrayHelper.cs
- TransformationRules.cs
- AttachedAnnotationChangedEventArgs.cs
- WebServiceResponseDesigner.cs
- RemotingSurrogateSelector.cs
- DataGridViewRowEventArgs.cs
- UnsafeNativeMethods.cs
- EntityTransaction.cs
- DataListDesigner.cs
- PolyBezierSegment.cs
- Cloud.cs
- BuilderElements.cs
- GridViewEditEventArgs.cs
- InputProcessorProfiles.cs
- HttpStreamFormatter.cs
- Directory.cs
- Int32Collection.cs
- TiffBitmapEncoder.cs
- DataGridColumnStyleMappingNameEditor.cs
- EventEntry.cs
- Wizard.cs
- DesignTableCollection.cs
- EncryptedPackageFilter.cs
- GcSettings.cs
- HelloMessageCD1.cs
- XmlILModule.cs
- AttachmentCollection.cs
- GestureRecognizer.cs
- TextBox.cs
- CornerRadiusConverter.cs
- PlainXmlDeserializer.cs
- UserControlBuildProvider.cs
- DefaultSection.cs
- CanExecuteRoutedEventArgs.cs
- ListenerConnectionDemuxer.cs
- AddInActivator.cs
- TransformationRules.cs
- SqlGenerator.cs
- tooltip.cs
- SelectionRange.cs
- WebPartRestoreVerb.cs
- SapiRecognizer.cs
- TileModeValidation.cs
- BindingList.cs
- DocumentXPathNavigator.cs
- CFStream.cs
- DeferredElementTreeState.cs
- RotateTransform.cs
- FileDialogCustomPlacesCollection.cs
- BamlMapTable.cs
- TreeViewDesigner.cs
- SqlStatistics.cs
- DataServiceRequest.cs
- AppDomainInfo.cs
- TempFiles.cs
- CustomWebEventKey.cs
- COAUTHIDENTITY.cs
- CallbackHandler.cs
- BoundPropertyEntry.cs
- ClientScriptManager.cs
- ListSortDescriptionCollection.cs
- __Filters.cs
- TextOptionsInternal.cs
- WinInetCache.cs
- LinqDataSourceEditData.cs
- ColorTransformHelper.cs
- ComponentResourceKey.cs
- SlotInfo.cs
- ConnectionsZone.cs
- DBNull.cs
- LinearGradientBrush.cs
- DbDeleteCommandTree.cs
- HttpCapabilitiesSectionHandler.cs
- SiteMapNodeCollection.cs
- AppendHelper.cs
- AnnouncementDispatcherAsyncResult.cs
- SoapIgnoreAttribute.cs
- SmtpDigestAuthenticationModule.cs
- VisualProxy.cs