public LogHandler(PersistedObjectSequence<LoggingEvent> sequence, FileHandlerFactoryLocator fileHandlerFactoryLocator, bool writeToConsole, DelegateQueue delegateQueue) : base(fileHandlerFactoryLocator) { this.sequence = sequence; this.delegateQueue = delegateQueue; this.writeToConsole = writeToConsole; this.sequence.ReadSequence(DateTime.MaxValue, 1, loggingEvent => { if (null != loggingEvent.Classname) this.classNames.Add(loggingEvent.Classname); if (null != loggingEvent.ExceptionClassname) this.classNames.Add(loggingEvent.ExceptionClassname); return false; }); }
public void Stop() { try { StopImpl(); } finally { try { _RequestDelegateQueue.Stop(); } catch (Exception e) { log.Error("Exception shutting down request handling threads", e); } _RequestDelegateQueue = null; } }
public virtual void StartServer() { // Don't start if the server is already running if (Running) return; // Register an event handler to preload default ObjectCloud objects EventHandler<IFileSystemResolver, EventArgs> preloadObjects = delegate(IFileSystemResolver sender, EventArgs e) { StartExecutionEnvironments(); }; FileHandlerFactoryLocator.FileSystemResolver.Started += preloadObjects; _RequestDelegateQueue = new DelegateQueue("Request handler", NumConcurrentRequests); RequestDelegateQueue.BusyThreshold = BusyThreshold; try { RunServer(); } catch { try { _RequestDelegateQueue.Stop(); } catch { } throw; } finally { FileHandlerFactoryLocator.FileSystemResolver.Started -= preloadObjects; } }