Exemple #1
0
        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;
            });
        }
Exemple #2
0
        public void Stop()
        {
            try
            {
                StopImpl();
            }
            finally
            {
                try
                {
                    _RequestDelegateQueue.Stop();
                }
                catch (Exception e)
                {
                    log.Error("Exception shutting down request handling threads", e);
                }

                _RequestDelegateQueue = null;
            }
        }
Exemple #3
0
        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;
            }
        }