Пример #1
0
        internal void InitiateShutdownInternal()
        {
            bool shutdown = false;

            if (!_shutdownInitated)
            {
                lock (this)
                {
                    if (!_shutdownInitated)
                    {
                        _shutdownInProgress = true;
                        shutdown            = true;
                        _shutdownInitated   = true;
                    }
                }
            }
            if (!shutdown)
            {
                return;
            }
            //HostingEnvironment initiated shutdown
            FluorineRuntime.SetShutdownReason(ApplicationShutdownReason.HostingEnvironment, "HostingEnvironment initiated shutdown");
            RemoveThisAppDomainFromAppManagerTableOnce();
            ThreadPool.QueueUserWorkItem(_initiateShutdownWorkItemCallback);
        }
Пример #2
0
        static FluorineRuntime()
        {
            try
            {
                _log = LogManager.GetLogger(typeof(FluorineRuntime));
            }
            catch {}

            _theRuntime = new FluorineRuntime();
            _theRuntime.Init();
        }
Пример #3
0
		static FluorineRuntime()
		{
			try
			{
				_log = LogManager.GetLogger(typeof(FluorineRuntime));
			}
			catch{}

			_theRuntime = new FluorineRuntime();
			_theRuntime.Init();
		}
Пример #4
0
        private void ShutdownThisAppDomainOnce()
        {
            bool shutdown = false;

            if (!_appDomainShutdownStarted)
            {
                lock (this)
                {
                    if (!_appDomainShutdownStarted)
                    {
                        shutdown = true;
                        _appDomainShutdownStarted = true;
                    }
                }
            }
            if (shutdown)
            {
                FluorineRuntime.SetUserForcedShutdown();
                _shutdownInProgress = false;
                FluorineRuntime.ShutdownAppDomain(ApplicationShutdownReason.HostingEnvironment, SR.GetString(SR.HostingEnvRestart));
            }
        }
Пример #5
0
        private void OnFileChanged(object sender, FileSystemEventArgs args)
        {
            lock (((ICollection)_watchers).SyncRoot)
            {
                if (_appShutdown)
                {
                    return;
                }
                Stop(false);

                // Disable event raising to avoid concurrent restarts
                DisableWatchers();

                ApplicationShutdownReason reason = ApplicationShutdownReason.None;
                string name    = new DirectoryInfo(args.FullPath).Name;
                string message = name + " dir change or directory rename";
                if (StringUtil.EqualsIgnoreCase(name, "web.config"))
                {
                    reason  = ApplicationShutdownReason.ConfigurationChange;
                    message = "Config file change";
                }
                else if (StringUtil.EqualsIgnoreCase(name, "bin"))
                {
                    reason = ApplicationShutdownReason.BinDirChangeOrDirectoryRename;
                }
                else
                {
                    reason = ApplicationShutdownReason.ConfigurationChange;
                }
                if (args.ChangeType == WatcherChangeTypes.Created)
                {
                    FluorineRuntime.SetUserForcedShutdown();
                }
                // Restart application
                FluorineRuntime.ShutdownAppDomain(reason, message);
            }
        }