public virtual bool IsDuplicate(object obj) { HostEvent hostEvent = obj as HostEvent; if (hostEvent == null) { return(false); // this is not null so they are different } ApplicationInfo applicationInfo1 = ApplicationInfo; ApplicationShutdownReason reason1 = Reason; ApplicationInfo applicationInfo2 = hostEvent.ApplicationInfo; ApplicationShutdownReason reason2 = hostEvent.Reason; return(applicationInfo1 != null && applicationInfo2 != null && applicationInfo1.Id == applicationInfo2.Id && reason1 == reason2); }
private void RaiseEvents(Queue deQueue) { if ((deQueue != null) && (deQueue.Count > 0)) { while (deQueue.Count > 0) { HostEvent hostEvent = deQueue.Dequeue() as HostEvent; if (hostEvent != null) { switch (hostEvent.Reason) { case ApplicationShutdownReason.ConfigurationChange: if (_log != null && _log.IsDebugEnabled) { _log.Debug(string.Format("Restarting application {0}", hostEvent.ApplicationInfo.PhysicalPath)); } StartApplication(hostEvent.ApplicationInfo.PhysicalPath); if (ApplicationRestart != null) { ApplicationRestart(this, new ApplicationRestartEventArgs(hostEvent.ApplicationInfo, hostEvent.Reason)); } break; case ApplicationShutdownReason.BinDirChangeOrDirectoryRename: if (_log != null && _log.IsDebugEnabled) { _log.Debug(string.Format("Restarting application {0}", hostEvent.ApplicationInfo.PhysicalPath)); } StartApplication(hostEvent.ApplicationInfo.PhysicalPath); if (ApplicationRestart != null) { ApplicationRestart(this, new ApplicationRestartEventArgs(hostEvent.ApplicationInfo, hostEvent.Reason)); } break; default: if (ApplicationShutdown != null) { ApplicationShutdown(this, new ApplicationShutdownEventArgs(hostEvent.ApplicationInfo, hostEvent.Reason)); } break; } } } } }