public Dispatcher(int threadCount, ThreadPriority priority, DispatcherOptions options, ApartmentState threadApartmentState, int maxThreadStackSize, string threadPoolName) { if (threadCount == 0) { threadCount = Math.Max(Dispatcher.NumberOfProcessorsInternal, 2) * Dispatcher.ThreadsPerCpu; } else if (threadCount < 0) { throw new ArgumentException("Cannot create a negative number of threads. Pass 0 to use default.", "threadCount"); } if (threadPoolName == null) { _name = string.Empty; } else { _name = threadPoolName; } _options = options; for (int i = 0; i < threadCount; i++) { AddWorker(priority, threadApartmentState, maxThreadStackSize); } StartWorkers(); }
public Dispatcher(DispatcherOptions options = null, Func <FetchTarget, Task <FetchTarget> > transform = null) { transform = transform ?? Dispatch; _options = options; _priority = new Queue <KeyValuePair <DateTimeOffset, Queue <FetchTarget> > >(); _hosts = new Dictionary <string, Queue <FetchTarget> >(); _inner = new TransformBlock <FetchTarget, FetchTarget>(transform, new ExecutionDataflowBlockOptions { MaxDegreeOfParallelism = 1 }); }
public void ConfigureDispatcher(DispatcherOptions options) { options.Matchers.Add(new TreeMatcher() { Endpoints = { new RoutePatternEndpoint("api/products", Products_Fallback), new RoutePatternEndpoint("api/products", new { controller = "Products",action = "Get", }, "GET", Products_Get), new RoutePatternEndpoint("api/products/{id}", new { controller = "Products",action = "Get", }, "GET", Products_GetWithId), new RoutePatternEndpoint("api/products", new { controller = "Products",action = "Post", }, "POST", Products_Post), new RoutePatternEndpoint("api/products/{id}", new { controller = "Products",action = "Put", }, "PUT", Products_Put), }, Selectors = { new HttpMethodEndpointSelector(), }, }, new RoutePatternEndpointHandlerFactory()); }
public Dispatcher(int threadCount, ThreadPriority priority, DispatcherOptions options, string threadPoolName) { maxThreads = threadCount; this.priority = priority; this.options = options; Name = threadPoolName; }
public Dispatcher(int threadCount, ThreadPriority priority, DispatcherOptions options, ApartmentState threadApartmentState, int maxThreadStackSize, string threadPoolName) : this(threadCount, priority, options, threadApartmentState, threadPoolName) { this.maxThreadStackSize = maxThreadStackSize; }
public Dispatcher( int threadCount, ThreadPriority priority, DispatcherOptions options, ApartmentState threadApartmentState, string threadPoolName) : this(threadCount, priority, options, threadPoolName) { this.state = threadApartmentState; }
public Dispatcher(int threadCount, ThreadPriority priority, DispatcherOptions options, ApartmentState threadApartmentState, string threadPoolName) : this(threadCount, priority, options, threadApartmentState, 0, threadPoolName) { }