Exemple #1
0
        public override void Complete()
        {
            if (IsCompleted())
            {
                // complete() was called more than once
                IMessage evt0 = new DefaultEvent("CAT", "BadInstrument")
                {
                    Status = "TransactionAlreadyCompleted"
                };

                evt0.Complete();
                AddChild(evt0);
            }
            else
            {
                _mDurationInMicro = MilliSecondTimer.CurrentTimeMicros() - TimestampInMicros;

                SetCompleted(true);

                if (_endCallBack != null)
                {
                    _endCallBack(this);
                }
            }
        }
        public override void Complete()
        {
            if (IsCompleted())
            {
                // complete() was called more than once
                IMessage evt0 = new DefaultEvent("CAT", "BadInstrument") {Status = "TransactionAlreadyCompleted"};

                evt0.Complete();
                AddChild(evt0);
            }
            else
            {
                _mDurationInMicro = MilliSecondTimer.CurrentTimeMicros() - TimestampInMicros;

                SetCompleted(true);

                if (_endCallBack != null)
                {
                    _endCallBack(this);
                }
            }
        }
            //验证Transaction
            internal void ValidateTransaction(ITransaction transaction)
            {
                IList<IMessage> children = transaction.Children;
                int len = children.Count;
                for (int i = 0; i < len; i++)
                {
                    IMessage message = children[i];
                    var transaction1 = message as ITransaction;
                    if (transaction1 != null)
                    {
                        ValidateTransaction(transaction1);
                    }
                }

                if (!transaction.IsCompleted())
                {
                    // missing transaction end, log a BadInstrument event so that
                    // developer can fix the code
                    IMessage notCompleteEvent = new DefaultEvent("CAT", "BadInstrument")
                                                    {Status = "TransactionNotCompleted"};
                    notCompleteEvent.Complete();
                    transaction.AddChild(notCompleteEvent);
                    transaction.Complete();
                }
            }