private static void PerformStart()
        {
            Thread.MemoryBarrier();
            var svc = __agent;
            Thread.MemoryBarrier();

            if (svc == null)
            {
                svc = new TMailService();
                if (Interlocked.CompareExchange(ref __agent, svc, null) == null)
                {
                    svc.StartAgentLogic((s, t) =>
                        {
                            svc.OnWriteLine += OnWriteLine;
                            OnWriteLine(s, "Agent service started");
                        });
                }
            }
        }
        private void PerfromStart(TMailService agent)
        {
            try
            {
                //this.TraceData(TraceEventType.Information, "TMailAgent PerformStarting ..");
                WriteDebugLine("PerformStart Begin..");
                //this.LogInfo("TMailAgent PerformStarting ..");
                agent.StartAgentLogic(null);
                 WriteDebugLine("PerformStart Done..");
                //this.TraceData(TraceEventType.Information, "TMailAgent PerformStarted ..");
                //this.LogInfo("TMailAgent PerformStarted ..");

            }
            catch (Exception ex)
            {
                //this.TraceData(TraceEventType.Information, "TMailAgent failed to PerformStart: {0}", ex.Message);
                //this.LogInfo("TMailAgent failed to PerformStart: {0}",ex.Message);
                //this.TraceData(TraceEventType.Error, "Unexpected Error In PerformStart", ex.FormatForLogging());
                YPMon.Critical("TMailAgentService", "Unexpected Error In PerformStart", ex.FormatForLogging());
                throw;
            }
        }