Complete() public method

public Complete ( ) : void
return void
 private void MarkAsNotCompleted(DefaultTransaction transaction)
 {
     IEvent notCompleteEvent = new DefaultEvent("CAT", "BadInstrument") { Status = "TransactionNotCompleted" };
     notCompleteEvent.Complete();
     transaction.AddChild(notCompleteEvent);
     transaction.Complete();
 }
Example #2
0
        private IMessageTree MergeTree()
        {
            var max = PureCatConstants.MAX_CHILD_NUMBER;
            var tran = new DefaultTransaction("_CatMergeTree", "_CatMergeTree");
            IMessageTree first = null;
            if (!_atomicTress.TryDequeue(out first))
            {
                return null;
            }

            tran.Status = PureCatConstants.SUCCESS;
            tran.Complete();
            tran.AddChild(first.Message);
            tran.Timestamp = first.Message.Timestamp;

            long lastTimestamp = 0;
            long lastDuration = 0;

            while (max-- >= 0)
            {
                IMessageTree tree = null;
                if (!_atomicTress.TryDequeue(out tree))
                {
                    tran.DurationInMillis = (lastTimestamp - tran.Timestamp + lastDuration);
                    break;
                }
                lastTimestamp = tree.Message.Timestamp;
                if (tree.Message is DefaultTransaction)
                {
                    lastDuration = ((DefaultTransaction)tree.Message).DurationInMillis;
                }
                else
                {
                    lastDuration = 0;
                }
                tran.AddChild(tree.Message);
            }
            first.Message = tran;
            return first;
        }