Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Dispatcher / ThreadSafeMessageFilterTable.cs / 1 / ThreadSafeMessageFilterTable.cs
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------
namespace System.ServiceModel.Dispatcher
{
using System;
using System.Threading;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.Collections;
using System.Collections.Generic;
internal class ThreadSafeMessageFilterTable : IMessageFilterTable
{
MessageFilterTable table;
object syncRoot;
internal ThreadSafeMessageFilterTable()
{
this.table = new MessageFilterTable();
this.syncRoot = new object();
}
internal object SyncRoot
{
get { return this.syncRoot; }
}
public int DefaultPriority
{
get
{
lock (this.syncRoot)
{
return this.table.DefaultPriority;
}
}
set
{
lock (this.syncRoot)
{
this.table.DefaultPriority = value;
}
}
}
internal void Add(MessageFilter filter, FilterData data, int priority)
{
lock (this.syncRoot)
{
this.table.Add(filter, data, priority);
}
}
//
// IMessageFilterTable methods
//
public int Count
{
get
{
lock (this.syncRoot)
{
return this.table.Count;
}
}
}
public void Clear()
{
lock (this.syncRoot)
{
this.table.Clear();
}
}
public bool GetMatchingValue(Message message, out FilterData data)
{
lock (this.syncRoot)
{
return this.table.GetMatchingValue(message, out data);
}
}
public bool GetMatchingValue(MessageBuffer buffer, out FilterData data)
{
lock (this.syncRoot)
{
return this.table.GetMatchingValue(buffer, out data);
}
}
public bool GetMatchingValues(Message message, ICollection results)
{
lock (this.syncRoot)
{
return this.table.GetMatchingValues(message, results);
}
}
public bool GetMatchingValues(MessageBuffer buffer, ICollection results)
{
lock (this.syncRoot)
{
return this.table.GetMatchingValues(buffer, results);
}
}
public bool GetMatchingFilter(Message message, out MessageFilter filter)
{
lock (this.syncRoot)
{
return this.table.GetMatchingFilter(message, out filter);
}
}
public bool GetMatchingFilter(MessageBuffer buffer, out MessageFilter filter)
{
lock (this.syncRoot)
{
return this.table.GetMatchingFilter(buffer, out filter);
}
}
public bool GetMatchingFilters(Message message, ICollection results)
{
lock (this.syncRoot)
{
return this.table.GetMatchingFilters(message, results);
}
}
public bool GetMatchingFilters(MessageBuffer buffer, ICollection results)
{
lock (this.syncRoot)
{
return this.table.GetMatchingFilters(buffer, results);
}
}
//
// IDictionary methods
//
public FilterData this[MessageFilter key]
{
get
{
lock (this.syncRoot)
{
return this.table[key];
}
}
set
{
lock (this.syncRoot)
{
this.table[key] = value;
}
}
}
public ICollection Keys
{
get
{
lock (this.syncRoot)
{
return this.table.Keys;
}
}
}
public ICollection Values
{
get
{
lock (this.syncRoot)
{
return this.table.Values;
}
}
}
public bool ContainsKey(MessageFilter key)
{
lock (this.syncRoot)
{
return this.table.ContainsKey(key);
}
}
public void Add(MessageFilter key, FilterData value)
{
lock (this.syncRoot)
{
this.table.Add(key, value);
}
}
public bool Remove(MessageFilter key)
{
lock (this.syncRoot)
{
return this.table.Remove(key);
}
}
//
// ICollection> methods
//
bool ICollection>.IsReadOnly
{
get
{
lock (this.syncRoot)
{
return ((ICollection>)this.table).IsReadOnly;
}
}
}
void ICollection>.Add(KeyValuePair item)
{
lock (this.syncRoot)
{
((ICollection>)this.table).Add(item);
}
}
bool ICollection>.Contains(KeyValuePair item)
{
lock (this.syncRoot)
{
return ((ICollection>)this.table).Contains(item);
}
}
void ICollection>.CopyTo(KeyValuePair[] array, int arrayIndex)
{
lock (this.syncRoot)
{
((ICollection>)this.table).CopyTo(array, arrayIndex);
}
}
bool ICollection>.Remove(KeyValuePair item)
{
lock (this.syncRoot)
{
return ((ICollection>)this.table).Remove(item);
}
}
IEnumerator IEnumerable.GetEnumerator()
{
lock (this.syncRoot)
{
return ((IEnumerable>)this).GetEnumerator();
}
}
IEnumerator> IEnumerable>.GetEnumerator()
{
lock (this.syncRoot)
{
return ((ICollection>)this.table).GetEnumerator();
}
}
public bool TryGetValue(MessageFilter filter, out FilterData data)
{
lock (this.syncRoot)
{
return this.table.TryGetValue(filter, out data);
}
}
}
}
// 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
- TypeGeneratedEventArgs.cs
- SchemaCollectionPreprocessor.cs
- ReadOnlyTernaryTree.cs
- UnsafeNativeMethods.cs
- LicFileLicenseProvider.cs
- returneventsaver.cs
- BatchServiceHost.cs
- ObjectTypeMapping.cs
- BypassElementCollection.cs
- DetailsViewUpdateEventArgs.cs
- DomainUpDown.cs
- KeyValueConfigurationElement.cs
- PersistenceParticipant.cs
- ProtocolsSection.cs
- UpdateCompiler.cs
- XmlSchemaComplexContentRestriction.cs
- DocumentSignatureManager.cs
- HttpCacheParams.cs
- StructuralType.cs
- FixedTextView.cs
- SqlNamer.cs
- Typeface.cs
- RequestResponse.cs
- WrapPanel.cs
- ConnectionStringsExpressionBuilder.cs
- DPTypeDescriptorContext.cs
- ScriptReferenceBase.cs
- KeySplineConverter.cs
- DataGridDetailsPresenter.cs
- XmlIlTypeHelper.cs
- DataBindEngine.cs
- LocalizedNameDescriptionPair.cs
- NameValuePair.cs
- ObjectListItem.cs
- BuildResult.cs
- MessageEncodingBindingElementImporter.cs
- Material.cs
- SmiTypedGetterSetter.cs
- NamespaceImport.cs
- Canvas.cs
- LocalFileSettingsProvider.cs
- Inflater.cs
- HttpCapabilitiesEvaluator.cs
- MenuScrollingVisibilityConverter.cs
- OuterGlowBitmapEffect.cs
- ElapsedEventArgs.cs
- QuaternionAnimation.cs
- SignedXmlDebugLog.cs
- SchemaCollectionPreprocessor.cs
- InternalBufferOverflowException.cs
- XmlSchemaGroupRef.cs
- TextEncodedRawTextWriter.cs
- ConfigXmlWhitespace.cs
- ProfilePropertySettingsCollection.cs
- ComponentChangingEvent.cs
- FrameworkRichTextComposition.cs
- ControlCollection.cs
- SafeViewOfFileHandle.cs
- FixedSOMSemanticBox.cs
- DiscoveryClientChannelBase.cs
- HttpRequestTraceRecord.cs
- JournalEntryListConverter.cs
- PropertyTab.cs
- SqlReorderer.cs
- XmlAutoDetectWriter.cs
- ContentPlaceHolderDesigner.cs
- EditorPartCollection.cs
- ObjectParameter.cs
- WriteableBitmap.cs
- ExitEventArgs.cs
- DataObjectAttribute.cs
- __Error.cs
- _SSPISessionCache.cs
- NetworkAddressChange.cs
- PermissionSetTriple.cs
- DataTrigger.cs
- MsiStyleLogWriter.cs
- SchemeSettingElement.cs
- SecurityChannelFaultConverter.cs
- SecurityTokenSpecification.cs
- XmlToDatasetMap.cs
- DbSetClause.cs
- RefreshEventArgs.cs
- SmiTypedGetterSetter.cs
- DBSqlParserColumnCollection.cs
- StylusPointPropertyInfo.cs
- PropertyItem.cs
- User.cs
- Unit.cs
- SerializationStore.cs
- Rotation3D.cs
- SoapAttributeAttribute.cs
- RegisteredExpandoAttribute.cs
- LoaderAllocator.cs
- RangeValueProviderWrapper.cs
- Connector.cs
- DisplayNameAttribute.cs
- InternalPolicyElement.cs
- DataGridPagerStyle.cs
- COM2ExtendedUITypeEditor.cs