Exemplo n.º 1
0
        private void CompleteTransaction(Transaction root)
        {
            root.Depth--;
            var depth = root.Depth;

            if (depth == 0)
            {
                #region 时间间隔(毫秒计算)
                root.TimeSpanInMilliseconds =
                    MilliSecondTimer.TimeSpanInMilliseconds(root.Time, MilliSecondTimer.CurrentTime());
                #endregion
                return;
            }
            //
            var countE = root.Evens.Count;
            if (countE == 0)
            {
                return;
            }
            var rootEven = root.Evens[countE - 1];
            var countT   = rootEven.Transactions.Count;
            if (countT == 0)
            {
                return;
            }
            var currentT = rootEven.Transactions[countT - 1];
            CompleteTransaction(currentT);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 创建事件
 /// </summary>
 /// <param name="e"></param>
 public void NewEven(Even e)
 {
     Evens.Add(e);
     #region 时间间隔(毫秒计算)
     var count = Evens.Count;
     if (count > 2)
     {
         var preItem = Evens[count - 2];
         var curItem = Evens[count - 1];
         preItem.TimeSpanInMilliseconds = MilliSecondTimer.TimeSpanInMilliseconds(preItem.Time, curItem.Time);
     }
     #endregion
 }
Exemplo n.º 3
0
        /// <summary>
        /// 业务事务-完成
        /// 访问属性-public=>private
        /// </summary>
        private void Complete()
        {
            var ctx = _manager.GetContext();

            CompleteTransaction(ctx.Transaction);
            if (ctx.Transaction.Depth == 0)
            {
                ctx.EndTime = MilliSecondTimer.CurrentTime();
                #region 时间间隔(毫秒计算)
                ctx.TimeSpanInMilliseconds = MilliSecondTimer.TimeSpanInMilliseconds(ctx.BeginTime, ctx.EndTime);
                #endregion
                var log = MessagePrint.PlainTextMessage(ctx);
                //LOG Exception
                LogHelper.Instance.Info(log);
                //Logger.Info(log);
                //
                ctx.Transaction = null;
                //
                _manager.Dispose();
            }
        }