public AutoRouter(Router processor, Parser argParser, DependencyResolver resolver, bool debug) { m_logger = new CategoryLogger(this); m_processor = processor; m_taskResultLookup = new Dictionary<Type, PropertyInfo>(); m_argParser = argParser; m_resolver = resolver; m_debug = debug; CacheResultProperty(typeof(Task<object>)); }
public AsyncHttpListener(IHttpProcessor processor, int port = 80, int securePort = 433, bool keepAlive = true, IPAddress bindTo = null) { m_listener = new HttpListener { IgnoreWriteExceptions = true }; m_processor = processor; m_keepAlive = keepAlive; m_resetEvent = new ManualResetEventSlim(true); m_logger = new CategoryLogger(this); var bind = bindTo != null && bindTo != IPAddress.Any ? bindTo.ToString() : "*"; if (port != 0) m_listener.Prefixes.Add(string.Format("http://{0}:{1}/", bind, port)); if (securePort != 0) { CertAssert(securePort); m_listener.Prefixes.Add(string.Format("https://{0}:{1}/", bind, securePort)); } }
public QueueProcessor(string name, Action preLoopAction = null, ThreadPriority priority = ThreadPriority.Normal) { m_logger = new CategoryLogger(this); m_queue = new BlockingCollection<Action>(); m_thread = new Thread(() => { if (preLoopAction != null) preLoopAction(); while (true) { Action entry; try { entry = m_queue.Take(); } // Thread should stop once we're out of stuff to process catch (InvalidOperationException) { return; } try { entry(); } catch (Exception ex) { try { m_logger.Error("Error in processing queue '{0}': {1}", name, ex); } catch { Debug.Fail("Pathological case: top-level handler failed"); } } } }) { IsBackground = true, Name = name, Priority = priority }; m_thread.Start(); }
public FileLogger(string name) { m_logger = new CategoryLogger(this); m_name = name; Rotate(); }