コード例 #1
0
        public void MaxRetryAttempts_Set_ThrowsAnException_OnNegativeValues()
        {
            var options = new ServerSupervisorOptions();

            Assert.Throws<ArgumentOutOfRangeException>(
                () => options.MaxRetryAttempts = -1);
        }
コード例 #2
0
 public ServerSupervisorFacts()
 {
     _component = new Mock<IServerComponent>();
     _options = new ServerSupervisorOptions
     {
         ShutdownTimeout = Timeout.InfiniteTimeSpan // Letting tests to timeout
     };
 }
コード例 #3
0
        public ServerSupervisor(IServerComponent component, ServerSupervisorOptions options)
        {
            if (component == null) throw new ArgumentNullException("component");
            if (options == null) throw new ArgumentNullException("options");

            _component = component;
            _options = options;

            _logger = LogManager.GetLogger(_component.GetType());
            _thread = new Thread(RunComponent) { IsBackground = true, Name = component.ToString() };

            _logger.TraceFormat("Starting a new thread for server component '{0}'...", _component);
            _thread.Start();
        }
コード例 #4
0
ファイル: ServerSupervisor.cs プロジェクト: swiggins/Hangfire
        public ServerSupervisor(IServerComponent component, ServerSupervisorOptions options)
        {
            if (component == null)
            {
                throw new ArgumentNullException("component");
            }
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            _component = component;
            _options   = options;

            _logger = LogProvider.GetLogger(_component.GetType());
            _thread = new Thread(RunComponent)
            {
                IsBackground = true, Name = component.ToString()
            };

            _logger.TraceFormat("Starting a new thread for server component '{0}'...", _component);
            _thread.Start();
        }
コード例 #5
0
 private static ServerSupervisor CreateSupervisor(IServerComponent component, ServerSupervisorOptions options)
 {
     return new ServerSupervisor(new AutomaticRetryServerComponentWrapper(component), options);
 }