public virtual void Setup(string messageTreeId)
        {
            JasmineContext ctx = new JasmineContext(m_ClientConfig.Domain.Id, m_HostName,
                                                    m_ClientConfig.Domain.Ip);

            m_Context[messageTreeId] = ctx;
        }
        public virtual void Add(IMessage message, string messageTreeId)
        {
            JasmineContext ctx = GetContext(messageTreeId);

            if (ctx != null)
            {
                ctx.Add(this, message);
            }
            else
            {
                LoggerManager.Warn("Context没取到");
            }
        }
        public virtual void End(ITransaction transaction, string messageTreeId)
        {
            JasmineContext ctx = GetContext(messageTreeId);

            if (ctx != null)
            {
                //if (!transaction.Standalone) return;
                if (ctx.End(this, transaction))
                {
                    m_Context.Dispose(messageTreeId);
                }
            }
            else
            {
                LoggerManager.Warn("Context没取到");
            }
        }
        public virtual void Start(ITransaction transaction, string messageTreeId)
        {
            JasmineContext ctx = GetContext(messageTreeId);

            if (ctx != null)
            {
                ctx.Start(this, transaction);
            }
            else if (m_FirstMessage)
            {
                m_FirstMessage = false;
                LoggerManager.Info("CAT client is not enabled because it's not initialized yet");
            }
            else
            {
                LoggerManager.Warn("Context没取到");
            }
        }
        internal JasmineContext GetContext(string messageTreeId)
        {
            if (Jasmine.IsInitialized(messageTreeId))
            {
                JasmineContext ctx = m_Context[messageTreeId];

                if (ctx != null)
                {
                    return(ctx);
                }
                if (m_ClientConfig.DevMode)
                {
                    throw new Exception(
                              "Cat has not been initialized successfully, please call Cal.setup(...) first for each thread.");
                }
            }

            return(null);
        }
        public virtual IMessageTree GetMessageTree(string messageTreeId)
        {
            JasmineContext ctx = m_Context[messageTreeId];

            return(ctx != null ? ctx.Tree : null);
        }
        public virtual ITransaction PeekTransaction(string messageTreeId)
        {
            JasmineContext ctx = GetContext(messageTreeId);

            return(ctx != null?ctx.PeekTransaction() : new NullTransaction());
        }