示例#1
0
        /// <summary>
        /// Gets a singleton instance
        /// </summary>
        /// <returns>singleton instance</returns>
        private static BrokerPerformanceCounter GetInstance()
        {
            lock (lockThis)
            {
                if (instance == null)
                {
                    try
                    {
                        instance = new BrokerPerformanceCounter();
                    }
                    catch (Exception e)
                    {
                        BrokerTracing.TraceEvent(TraceEventType.Warning, 0, "Exception throwed while initializing broker performance counter: {0}", e);
                        throw;
                    }
                }

                return(instance);
            }
        }
示例#2
0
 /// <summary>
 /// Update the performance counter
 /// </summary>
 public void UpdatePerformanceCounter()
 {
     BrokerPerformanceCounter.IncrementPerfCounterBy(this.key, Interlocked.Read(ref this.total) - Interlocked.Read(ref this.preTotal));
     this.preTotal = Interlocked.Read(ref this.total);
 }