コード例 #1
0
        protected virtual void Consumer_PendingResponseObtained
            (
            object sender,
            JobProcessedEventArgs e
            )
        {
            //TODO: (SD) use SynchronizedCounter(s)
            try
            {
                Monitor.Enter(countersSyncLock);
                // TODO: That will be provided as TryEnter with configurable timout (SD)
                pendingResponseObtainedCount += 1;
                WaitForLowPrioritySubmissionDelayResetEvent.Reset();
            }
            finally
            {
                Monitor.Exit(countersSyncLock);
            }
            // by the call to the above sum of
            // PendingResponseObtainedCount+RegularResponseObtainedCount should never be zero
            bool isLinkDown = false;

            lock (CountersSyncLock)
            {
                isLinkDown =
                    (PendingResponseObtainedCount + RegularResponseObtainedCount)
                    > ThresholdMinimumSampleCount
                    &&
                    RegularResponseObtainedCount /
                    (PendingResponseObtainedCount + RegularResponseObtainedCount) * 100
                    < RegularToPendingThreshold;
            }
            if (isLinkDown)
            {
                try
                {
                    // That event is supposed to be handled by the Navitaire's handler as well
                    Log.TraceData(Log.Source,TraceEventType.Warning,
                                         0,
                                         //**new ContextualLogEntry
                                         //    {
                                         //        Message =
                                                     string.Format
                                                     (
                                                     "Number of Regularly Obtained Responses: {0}" +
                                                     "Number of Pending Responses: {1}",
                                                     RegularResponseObtainedCount,
                                                     PendingResponseObtainedCount
                                                     )//,
                                             //**    ContextIdentifier = e.OperationContextShortcut
                                             );
                }
                catch
                {
                    // TODO: Log separately to the fall back log (SD)
                }
                ResetPendingResponseObtainedCount();
                ResetRegularResponseObtainedCount();
            }
        }
コード例 #2
0
 protected virtual void Consumer_RegularResponseObtained
     (
     object sender,
     JobProcessedEventArgs e
     )
 {
     //TODO: (SD) use SynchronizedCounter(s)
     try
     {
         Monitor.Enter(countersSyncLock);
         // TODO: That will be provided as TryEnter with configurable timout (SD)
         regularResponseObtainedCount += 1;
         pendingResponseObtainedCount = 0;
         WaitForLowPrioritySubmissionDelayResetEvent.Set();
     }
     finally
     {
         Monitor.Exit(countersSyncLock);
     }
 }