コード例 #1
0
        private void UseNotificationPipeCallback(IAsyncResult async)
        {
            OwaAsyncResult        owaAsyncResult        = (OwaAsyncResult)async;
            PendingRequestChannel pendingRequestChannel = null;

            if (this.pendingRequestManager == null)
            {
                return;
            }
            pendingRequestChannel = this.pendingRequestManager.GetPendingGetChannel(owaAsyncResult.PendingGetId);
            if (pendingRequestChannel == null)
            {
                return;
            }
            try
            {
                pendingRequestChannel.EndSendNotification(owaAsyncResult);
            }
            catch (Exception exception)
            {
                if (this.pgEventDataDictionary.ContainsKey(owaAsyncResult.PendingGetId))
                {
                    lock (this.pgEventDataDictionary[owaAsyncResult.PendingGetId].AsyncResult)
                    {
                        if (!this.pgEventDataDictionary[owaAsyncResult.PendingGetId].AsyncResult.IsCompleted)
                        {
                            this.pgEventDataDictionary[owaAsyncResult.PendingGetId].AsyncResult.Exception = exception;
                        }
                    }
                }
            }
            try
            {
                lock (this.pgEventDataDictionary)
                {
                    if (this.pgEventDataDictionary.ContainsKey(owaAsyncResult.PendingGetId))
                    {
                        lock (this.pgEventDataDictionary[owaAsyncResult.PendingGetId].AsyncResult)
                        {
                            if (!this.pgEventDataDictionary[owaAsyncResult.PendingGetId].AsyncResult.IsCompleted)
                            {
                                this.pgEventDataDictionary[owaAsyncResult.PendingGetId].AsyncResult.CompleteRequest(owaAsyncResult.CompletedSynchronously);
                            }
                        }
                        this.pgEventDataDictionary.Remove(owaAsyncResult.PendingGetId);
                    }
                }
            }
            finally
            {
                try
                {
                    pendingRequestChannel.RecordFinishPendingRequest();
                }
                catch (OwaOperationNotSupportedException ex)
                {
                    ExTraceGlobals.NotificationsCallTracer.TraceDebug <string>((long)this.GetHashCode(), "An exception was thrown during the processing of the async callback: {0}", ex.Message);
                }
            }
        }