Ejemplo n.º 1
0
        public void OnTimeout()
        {
            if (alreadyFired)
            {
                return;
            }
            var msg = this.Message; // Local working copy

            lock (this)
            {
                if (alreadyFired)
                {
                    return;
                }

                if (Config.ResendOnTimeout && resendFunc(msg))
                {
                    if (logger.IsVerbose)
                    {
                        logger.Verbose("OnTimeout - Resend {0} for {1}", msg.ResendCount, msg);
                    }
                    return;
                }

                alreadyFired = true;
                DisposeTimer();
                if (StatisticsCollector.CollectApplicationRequestsStats)
                {
                    timeSinceIssued.Stop();
                }

                if (unregister != null)
                {
                    unregister();
                }
            }

            string messageHistory = msg.GetTargetHistory();
            string errorMsg       = String.Format("Response did not arrive on time in {0} for message: {1}. Target History is: {2}",
                                                  timeout, msg, messageHistory);

            logger.Warn(ErrorCode.Runtime_Error_100157, "{0}. About to break its promise.", errorMsg);

            var error = new Message(Message.Categories.Application, Message.Directions.Response)
            {
                Result     = Message.ResponseTypes.Error,
                BodyObject = Response.ExceptionResponse(new TimeoutException(errorMsg))
            };

            if (StatisticsCollector.CollectApplicationRequestsStats)
            {
                ApplicationRequestsStatisticsGroup.OnAppRequestsEnd(timeSinceIssued.Elapsed);
                ApplicationRequestsStatisticsGroup.OnAppRequestsTimedOut();
            }

            callback(error, context);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Call once when the thread is stopped, must be called from the thread being tracked
 /// </summary>
 public void OnStopExecution()
 {
     // Only once a client has connected do we start tracking statistics
     if (ClientConnected)
     {
         ExecutingCpuCycleTime.Stop();
         ExecutingWallClockTime.Stop();
     }
 }
Ejemplo n.º 3
0
 public void OnStopExecution()
 {
     if (TrackExtraStats)
     {
         totalExecutionTime.Stop();
     }
 }
Ejemplo n.º 4
0
        public void DoCallback(Message response)
        {
            if (alreadyFired)
            {
                return;
            }
            lock (this)
            {
                if (alreadyFired)
                {
                    return;
                }

                if (response.Result == Message.ResponseTypes.Rejection && response.RejectionType == Message.RejectionTypes.Transient)
                {
                    if (resendFunc(Message))
                    {
                        return;
                    }
                }

                alreadyFired = true;
                DisposeTimer();
                if (StatisticsCollector.CollectApplicationRequestsStats)
                {
                    timeSinceIssued.Stop();
                }
                if (unregister != null)
                {
                    unregister();
                }
            }
            if (Message.WriteMessagingTraces)
            {
                response.AddTimestamp(Message.LifecycleTag.InvokeIncoming);
            }
            if (logger.IsVerbose2)
            {
                logger.Verbose2("Message {0} timestamps: {1}", response, response.GetTimestampString());
            }
            if (StatisticsCollector.CollectApplicationRequestsStats)
            {
                ApplicationRequestsStatisticsGroup.OnAppRequestsEnd(timeSinceIssued.Elapsed);
            }
            // do callback outside the CallbackData lock. Just not a good practice to hold a lock for this unrelated operation.
            callback(response, context);
        }
Ejemplo n.º 5
0
 public void OnDeQueueRequest(ITimeInterval itemInQueue)
 {
     itemInQueue.Stop();
     long ticks = itemInQueue.Elapsed.Ticks;
     averageTimeInQueue.AddValue(ticks);
     averageTimeInAllQueues.AddValue(ticks);
     totalTimeInAllQueues.IncrementBy(ticks);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Call once after processing multiple requests as a batch or a single request, must be called from the thread being tracked
 /// </summary>
 /// <param name="num">Number of processed requests</param>
 public void OnStopProcessing()
 {
     // Only once a client has connected do we start tracking statistics
     if (ClientConnected)
     {
         ProcessingCpuCycleTime.Stop();
         ProcessingWallClockTime.Stop();
     }
 }
Ejemplo n.º 7
0
        public void OnDeQueueRequest(ITimeInterval itemInQueue)
        {
            itemInQueue.Stop();
            long ticks = itemInQueue.Elapsed.Ticks;

            averageTimeInQueue.AddValue(ticks);
            averageTimeInAllQueues.AddValue(ticks);
            totalTimeInAllQueues.IncrementBy(ticks);
        }
Ejemplo n.º 8
0
        public void DoCallback(Message response)
        {
            if (alreadyFired)
            {
                return;
            }
            lock (this)
            {
                if (alreadyFired)
                {
                    return;
                }

                if (response.Result == Message.ResponseTypes.Rejection && response.RejectionType == Message.RejectionTypes.Transient)
                {
                    if (resendFunc(Message))
                    {
                        return;
                    }
                }

                alreadyFired = true;
                DisposeTimer();
                if (StatisticsCollector.CollectApplicationRequestsStats)
                {
                    timeSinceIssued.Stop();
                }
                if (unregister != null)
                {
                    unregister();
                }
            }
            if (StatisticsCollector.CollectApplicationRequestsStats)
            {
                ApplicationRequestsStatisticsGroup.OnAppRequestsEnd(timeSinceIssued.Elapsed);
            }
            // do callback outside the CallbackData lock. Just not a good practice to hold a lock for this unrelated operation.
            callback(response, context);
        }
Ejemplo n.º 9
0
 public void Stop()
 {
     timeInterval.Stop();
 }