public GccProtocolActivityLoggerSession(StoreSession storeSession)
 {
     using (DisposeGuard disposeGuard = this.Guard())
     {
         this.storeSessionReference     = GCHandle.Alloc(storeSession, GCHandleType.Weak);
         this.sessionResourceIdentifier = "Unknown";
         this.sessionClientIPAddress    = storeSession.ClientIPAddress;
         this.sessionServerIPAddress    = storeSession.ServerIPAddress;
         this.sessionTimestamp          = ExDateTime.MinValue;
         this.gccLogger = GccProtocolActivityLoggerSingleton.Get(storeSession.ClientInfoString);
         this.needToLog = false;
         if (this.gccLogger != null)
         {
             this.timeoutTimer           = new System.Timers.Timer();
             this.timeoutTimer.Elapsed  += this.LoggerTimeoutEventHandler;
             this.timeoutTimer.Interval  = GccProtocolActivityLogger.Config.ReportIntervalMilliseconds;
             this.timeoutTimer.AutoReset = false;
         }
         disposeGuard.Success();
     }
 }
        public static GccProtocolActivityLogger Get(string clientInfoString)
        {
            string protocolName = GccProtocolActivityLoggerSingleton.GetProtocolName(clientInfoString);

            if (!GccProtocolActivityLoggerSingleton.DoWeNeedToLog(protocolName))
            {
                return(null);
            }
            if (Interlocked.Exchange(ref GccProtocolActivityLoggerSingleton.creationNotMyJob, 1) == 0)
            {
                GccProtocolActivityLogger gccProtocolActivityLogger = new GccProtocolActivityLogger(protocolName);
                gccProtocolActivityLogger.Initialize();
                AppDomain.CurrentDomain.DomainUnload       += GccProtocolActivityLoggerSingleton.CloseLogSingleton;
                GccProtocolActivityLoggerSingleton.instance = gccProtocolActivityLogger;
                GccProtocolActivityLoggerSingleton.busyCreating.Set();
            }
            else if (GccProtocolActivityLoggerSingleton.instance == null)
            {
                GccProtocolActivityLoggerSingleton.busyCreating.WaitOne();
            }
            return(GccProtocolActivityLoggerSingleton.instance);
        }