Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Channels / ConnectionPoolRegistry.cs / 1 / ConnectionPoolRegistry.cs
//---------------------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------------------- namespace System.ServiceModel.Channels { using System.Diagnostics; using System.ServiceModel; using System.Collections.Generic; using System.ServiceModel.Diagnostics; abstract class ConnectionPoolRegistry { Dictionary> registry; protected ConnectionPoolRegistry() { registry = new Dictionary >(); } object ThisLock { get { return this.registry; } } // NOTE: performs the open on the pool for you public ConnectionPool Lookup(IConnectionOrientedTransportChannelFactorySettings settings) { ConnectionPool result = null; string key = settings.ConnectionPoolGroupName; lock (ThisLock) { List registryEntry = null; if (registry.TryGetValue(key, out registryEntry)) { for (int i = 0; i < registryEntry.Count; i++) { if (registryEntry[i].IsCompatible(settings) && registryEntry[i].TryOpen()) { result = registryEntry[i]; break; } } } else { registryEntry = new List (); registry.Add(key, registryEntry); } if (result == null) { result = CreatePool(settings); registryEntry.Add(result); } } return result; } protected abstract ConnectionPool CreatePool(IConnectionOrientedTransportChannelFactorySettings settings); public void Release(ConnectionPool pool, TimeSpan timeout) { lock (ThisLock) { if (pool.Close(timeout)) { List registryEntry = registry[pool.Name]; for (int i = 0; i < registryEntry.Count; i++) { if (object.ReferenceEquals(registryEntry[i], pool)) { registryEntry.RemoveAt(i); break; } } if (registryEntry.Count == 0) { registry.Remove(pool.Name); } } } } } } // 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
- GeometryHitTestParameters.cs
- XsdCachingReader.cs
- EntityDataSourceDataSelectionPanel.cs
- ProjectedSlot.cs
- MSHTMLHost.cs
- TextServicesPropertyRanges.cs
- BitmapImage.cs
- UInt32Converter.cs
- CodeDefaultValueExpression.cs
- Crc32Helper.cs
- CodeAttachEventStatement.cs
- DataSourceSelectArguments.cs
- StrongNameUtility.cs
- CodeDelegateCreateExpression.cs
- Expression.cs
- DeclaredTypeElement.cs
- SoapObjectWriter.cs
- DataListAutoFormat.cs
- XmlNodeChangedEventArgs.cs
- CustomTypeDescriptor.cs
- PassportAuthenticationModule.cs
- TrustManagerMoreInformation.cs
- TabControl.cs
- AnonymousIdentificationSection.cs
- PointKeyFrameCollection.cs
- ListViewItem.cs
- XmlSchemaSearchPattern.cs
- TextParaLineResult.cs
- DataServicePagingProviderWrapper.cs
- XmlUrlResolver.cs
- ValidationManager.cs
- VBIdentifierNameEditor.cs
- SqlXmlStorage.cs
- ViewCellRelation.cs
- SiteMapDataSource.cs
- InstanceLockQueryResult.cs
- XXXInfos.cs
- ManualResetEvent.cs
- DecimalConverter.cs
- Point3DConverter.cs
- OracleParameterCollection.cs
- SortDescriptionCollection.cs
- SafeProcessHandle.cs
- HtmlInputText.cs
- ScriptingScriptResourceHandlerSection.cs
- SQLMoneyStorage.cs
- FixedBufferAttribute.cs
- RadioButton.cs
- NavigateEvent.cs
- WindowsListViewGroupHelper.cs
- XamlDebuggerXmlReader.cs
- ThreadStaticAttribute.cs
- OpenFileDialog.cs
- GridViewCancelEditEventArgs.cs
- DesignRelation.cs
- EventSinkActivity.cs
- DynamicValueConverter.cs
- SafeBitVector32.cs
- XmlProcessingInstruction.cs
- XmlExtensionFunction.cs
- ExeContext.cs
- MemberJoinTreeNode.cs
- cookie.cs
- SchemaCompiler.cs
- XsltLoader.cs
- DecoderFallback.cs
- PaperSize.cs
- ImageClickEventArgs.cs
- Contracts.cs
- AudienceUriMode.cs
- ClockController.cs
- Signature.cs
- SqlDependencyListener.cs
- GenericTextProperties.cs
- ADMembershipProvider.cs
- HScrollProperties.cs
- MobilePage.cs
- GenericEnumerator.cs
- SchemaElement.cs
- ToolStripStatusLabel.cs
- ExceptionRoutedEventArgs.cs
- TaskbarItemInfo.cs
- CodePrimitiveExpression.cs
- Padding.cs
- PriorityQueue.cs
- DiffuseMaterial.cs
- VisualBasicSettingsHandler.cs
- basecomparevalidator.cs
- CommandPlan.cs
- _RequestCacheProtocol.cs
- ForceCopyBuildProvider.cs
- WorkflowMarkupSerializer.cs
- RoleBoolean.cs
- shaper.cs
- EventHandlerList.cs
- ObjectDataSourceDisposingEventArgs.cs
- SchemaImporter.cs
- SQLBytesStorage.cs
- Main.cs
- PenThreadPool.cs