Пример #1
0
 private Transaction AddEvent(Transaction root, Even node)
 {
     if (root.Depth == 0)
     {
         root.NewEven(node);
         return root;
     }
     root.Evens.Peek().Depth += 1;
     var T = root.Evens.Peek().Transactions.Pop();
     var newT = AddEvent(T, node);
     root.Evens.Peek().Transactions.Push(newT);
     return root;
 }
Пример #2
0
 private Even AddTransction(Even root, Transaction node)
 {
     if (root.Depth == 0)
     {
         root.Transactions.Push(node);
         return root;
     }
     root.Transactions.Peek().Depth += 1;
     var even= root.Transactions.Peek().Evens.Pop();
     var newEven = AddTransction(even, node);
     root.Transactions.Peek().Evens.Push(newEven);
     return root;
 }
Пример #3
0
        /// <summary>
        /// 创建监测业务事务
        /// </summary>
        /// <param name="type"></param>
        /// <param name="name"></param>
        public void NewTransaction(string type, string name)
        {
            var ctx = _manager.GetContext();
            var t = new Transaction(type, name);
            var rootEven = new Even("root", "root");
            if (ctx.Transaction != null)
            {
                rootEven.Depth = 10000;
                rootEven.Transactions.Push(ctx.Transaction);
            }
            var newEven = AddTransction(rootEven, t);
            ctx.Transaction = newEven.Transactions.Peek();

        }
Пример #4
0
 private Transaction CompleteTransaction(Transaction root,ref int num)
 {
     var depth = root.Depth - 1;
     if (depth < 0)
     {
         num = root.Evens.Count;
         return root;
     }
     var T = root.Evens.Peek().Transactions.Pop();
     var newT = CompleteTransaction(T,ref num);
     root.Depth -= 1;
     if (root.Evens.Peek().Depth < num)
     {
         throw new Exception("MyCat Exception: Transaction is not close!");
     }
     root.Evens.Peek().Depth -= num;
     root.Evens.Peek().Transactions.Push(newT);
     return root;
 }
Пример #5
0
 private Transaction AddExceptionEvent(Transaction root, string exception)
 {
     if (root.Depth == 0)
     {
         root.Evens.Peek().Exception = exception;
         return root;
     }
     var T = root.Evens.Peek().Transactions.Pop();
     var newT = AddExceptionEvent(T, exception);
     root.Evens.Peek().Transactions.Push(newT);
     return root;
 }