Esempio n. 1
0
        public async Task Stop()
        {
            if (_stopping)
            {
                return;
            }

            _log.Debug("GridDomain node {Id} is stopping", Id);
            _stopping = true;
            Container?.Dispose();

            try
            {
                _quartzScheduler?.Shutdown(false);
            }
            catch (Exception ex)
            {
                _log.Warn($"Got error on quartz scheduler shutdown: {ex}");
            }

            if (System != null)
            {
                await System.Terminate();

                System.Dispose();
            }

            _log.Debug("GridDomain node {Id} stopped", Id);
        }
Esempio n. 2
0
 protected override void OnStop()
 {
     if (scheduler == null)
     {
         return;
     }
     scheduler.Shutdown(true);
 }
Esempio n. 3
0
        void Application_End(object sender, EventArgs e)
        {
            //-----------------------关闭quartz----------------------------------
            sched.Shutdown();
            //-------------------------------------------------------------------

            Logger.Info("web关闭成功");
        }
Esempio n. 4
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (scheduler == null)
     {
         return;
     }
     scheduler.Shutdown(true);
 }
        /// <summary>
        /// Creates and runs the service host for the easynetq handler.
        /// </summary>
        /// <param name="serviceName">The name of the handler service.</param>
        /// <param name="container">The injection container used.</param>
        /// <param name="scheduler">The scheduler instance used.</param>
        private static void CreateAndRunServiceHost(string serviceName, IKernel container, Quartz.IScheduler scheduler)
        {
            HostFactory.Run(hostConfigurator =>
            {
                hostConfigurator.Service <IBusServiceHost>(s =>
                {
                    s.ConstructUsing(name => container.Get <IBusServiceHost>());
                    s.WhenStarted(tc => tc.Start());
                    s.WhenStopped(tc =>
                    {
                        try
                        {
                            // Release and Dispose ninject
                            container.Release(tc);
                            container.Dispose();
                        }
                        catch (Exception ex)
                        {
                            _logger.Error("Error: {0}", ex.Message);
                        }
                        finally
                        {
                            // Shutdown the scheduler
                            scheduler.Shutdown();
                        }
                    });
                });

                // These are default settings, refere to:
                // http://topshelf.readthedocs.org/en/latest/overview/commandline.html
                // for hpow to specify service options
                hostConfigurator.SetDisplayName(serviceName);
                hostConfigurator.SetDescription($"Handles messages defined for {serviceName} in RabbitMQ.");
                hostConfigurator.SetServiceName(serviceName.Replace(" ", ""));

                // The above options are overridden like:
                // EasyNetQ.GenericHost.exe install -servicename:myservice -description:"My Service description" -displayname:"MY Display Name"

                // The service runs as local system, you might want to modify that after the service is installed or
                // install with the --interactive option (make a .cdm file :-))
            });
        }
 public void Stop()
 {
   quartzScheduler.Shutdown(false);
 }
 protected override void OnStop()
 {
     scheduler.Shutdown();
 }
Esempio n. 8
0
 public bool Stop(HostControl hostControl)
 {
     scheduler.Shutdown(false);
     return(true);
 }