Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Channels / InputQueueChannel.cs / 1 / InputQueueChannel.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Channels { using System.Collections.Generic; abstract class InputQueueChannel: ChannelBase where TDisposable : class, IDisposable { InputQueue inputQueue; protected InputQueueChannel(ChannelManagerBase channelManager) : base(channelManager) { this.inputQueue = new InputQueue (); } public int InternalPendingItems { get { return this.inputQueue.PendingCount; } } public int PendingItems { get { ThrowIfDisposedOrNotOpen(); return InternalPendingItems; } } public void EnqueueAndDispatch(TDisposable item) { EnqueueAndDispatch(item, null); } public void EnqueueAndDispatch(TDisposable item, ItemDequeuedCallback dequeuedCallback, bool canDispatchOnThisThread) { OnEnqueueItem(item); // NOTE: don't need to check IsDisposed here: InputQueue will handle dispose inputQueue.EnqueueAndDispatch(item, dequeuedCallback, canDispatchOnThisThread); } public void EnqueueAndDispatch(Exception exception, ItemDequeuedCallback dequeuedCallback, bool canDispatchOnThisThread) { // NOTE: don't need to check IsDisposed here: InputQueue will handle dispose inputQueue.EnqueueAndDispatch(exception, dequeuedCallback, canDispatchOnThisThread); } public void EnqueueAndDispatch(TDisposable item, ItemDequeuedCallback dequeuedCallback) { OnEnqueueItem(item); // NOTE: don't need to check IsDisposed here: InputQueue will handle dispose inputQueue.EnqueueAndDispatch(item, dequeuedCallback); } public bool EnqueueWithoutDispatch(Exception exception, ItemDequeuedCallback dequeuedCallback) { // NOTE: don't need to check IsDisposed here: InputQueue will handle dispose return inputQueue.EnqueueWithoutDispatch(exception, dequeuedCallback); } public bool EnqueueWithoutDispatch(TDisposable item, ItemDequeuedCallback dequeuedCallback) { OnEnqueueItem(item); // NOTE: don't need to check IsDisposed here: InputQueue will handle dispose return inputQueue.EnqueueWithoutDispatch(item, dequeuedCallback); } public void Dispatch() { // NOTE: don't need to check IsDisposed here: InputQueue will handle dispose inputQueue.Dispatch(); } public void Shutdown() { inputQueue.Shutdown(); } protected override void OnFaulted() { base.OnFaulted(); inputQueue.Shutdown(this); } protected virtual void OnEnqueueItem(TDisposable item) { } protected IAsyncResult BeginDequeue(TimeSpan timeout, AsyncCallback callback, object state) { this.ThrowIfNotOpened(); return inputQueue.BeginDequeue(timeout, callback, state); } protected bool EndDequeue(IAsyncResult result, out TDisposable item) { bool dequeued = inputQueue.EndDequeue(result, out item); if (item == null) { this.ThrowIfFaulted(); this.ThrowIfAborted(); } return dequeued; } protected bool Dequeue(TimeSpan timeout, out TDisposable item) { this.ThrowIfNotOpened(); bool dequeued = inputQueue.Dequeue(timeout, out item); if (item == null) { this.ThrowIfFaulted(); this.ThrowIfAborted(); } return dequeued; } protected bool WaitForItem(TimeSpan timeout) { this.ThrowIfNotOpened(); bool dequeued = inputQueue.WaitForItem(timeout); this.ThrowIfFaulted(); this.ThrowIfAborted(); return dequeued; } protected IAsyncResult BeginWaitForItem(TimeSpan timeout, AsyncCallback callback, object state) { this.ThrowIfNotOpened(); return inputQueue.BeginWaitForItem(timeout, callback, state); } protected bool EndWaitForItem(IAsyncResult result) { bool dequeued = inputQueue.EndWaitForItem(result); this.ThrowIfFaulted(); this.ThrowIfAborted(); return dequeued; } protected override void OnClosing() { base.OnClosing(); inputQueue.Shutdown(this); } protected override void OnAbort() { inputQueue.Close(); } protected override void OnClose(TimeSpan timeout) { inputQueue.Close(); } protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state) { inputQueue.Close(); return new CompletedAsyncResult(callback, state); } protected override void OnEndClose(IAsyncResult result) { CompletedAsyncResult.End(result); } } } // 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
- DbConnectionClosed.cs
- MediaScriptCommandRoutedEventArgs.cs
- RawUIStateInputReport.cs
- ZipIOExtraField.cs
- TabItemAutomationPeer.cs
- RegistryPermission.cs
- QuaternionValueSerializer.cs
- AdditionalEntityFunctions.cs
- CodeAttributeDeclarationCollection.cs
- WebZone.cs
- M3DUtil.cs
- CodeSnippetTypeMember.cs
- MetadataCollection.cs
- LocalizableResourceBuilder.cs
- DuplicateDetector.cs
- AstTree.cs
- KeyValueConfigurationElement.cs
- _LazyAsyncResult.cs
- MessageHeader.cs
- SafeHandles.cs
- LiteralControl.cs
- XmlTextReaderImplHelpers.cs
- SplineKeyFrames.cs
- DatasetMethodGenerator.cs
- ModelPerspective.cs
- KeyGesture.cs
- GorillaCodec.cs
- EUCJPEncoding.cs
- AvtEvent.cs
- AppearanceEditorPart.cs
- PlaceHolder.cs
- CompilerGeneratedAttribute.cs
- XmlToDatasetMap.cs
- HttpListenerResponse.cs
- DataSourceProvider.cs
- TypeResolver.cs
- WebPartMinimizeVerb.cs
- MetadataFile.cs
- HttpDebugHandler.cs
- ListViewItem.cs
- FlowPosition.cs
- KeyToListMap.cs
- CodeConstructor.cs
- ParseChildrenAsPropertiesAttribute.cs
- AppDomainManager.cs
- SoapAttributes.cs
- WebPartMenu.cs
- CodeVariableDeclarationStatement.cs
- Path.cs
- ControlPersister.cs
- StatusBarDrawItemEvent.cs
- PhonemeConverter.cs
- HttpResponseHeader.cs
- SafePipeHandle.cs
- FilteredDataSetHelper.cs
- IteratorDescriptor.cs
- ProxyAttribute.cs
- TextElementEnumerator.cs
- _LoggingObject.cs
- ClaimTypeElement.cs
- SystemUdpStatistics.cs
- MappingItemCollection.cs
- OperationAbortedException.cs
- CommonDialog.cs
- ProgressBarHighlightConverter.cs
- SafeNativeMemoryHandle.cs
- _TLSstream.cs
- RecordBuilder.cs
- odbcmetadatafactory.cs
- PackageProperties.cs
- SynchronizedKeyedCollection.cs
- IisTraceListener.cs
- MappingMetadataHelper.cs
- TransformDescriptor.cs
- AutomationTextAttribute.cs
- Rotation3DAnimation.cs
- MediaPlayer.cs
- Point3DCollection.cs
- Light.cs
- ProcessModuleDesigner.cs
- UmAlQuraCalendar.cs
- LicenseProviderAttribute.cs
- SelfIssuedSamlTokenFactory.cs
- StreamGeometryContext.cs
- DrawingAttributesDefaultValueFactory.cs
- MarginsConverter.cs
- Rules.cs
- MasterPageBuildProvider.cs
- ProviderConnectionPointCollection.cs
- RootBrowserWindow.cs
- ToolStripContentPanel.cs
- MiniParameterInfo.cs
- ToolboxCategoryItems.cs
- XmlWriterSettings.cs
- TextSelection.cs
- PagesSection.cs
- Line.cs
- DeclarativeCatalogPart.cs
- ApplicationSecurityManager.cs
- BooleanFunctions.cs