MCPcopy Create free account
hub / github.com/apache/impala / ThreadPoolBuilder

Class ThreadPoolBuilder

be/src/kudu/util/threadpool.h:113–146  ·  view source on GitHub ↗

ThreadPool takes a lot of arguments. We provide sane defaults with a builder. name: Used for debugging output and default names of the worker threads. Since thread names are limited to 16 characters on Linux, it's good to choose a short name here. Required. trace_metric_prefix: used to prefix the names of TraceMetric counters. When a task on a thread pool has an associated trace, the thread pool

Source from the content-addressed store, hash-verified

111// Default: not set.
112//
113class ThreadPoolBuilder {
114 public:
115 explicit ThreadPoolBuilder(std::string name);
116
117 // Note: We violate the style guide by returning mutable references here
118 // in order to provide traditional Builder pattern conveniences.
119 ThreadPoolBuilder& set_trace_metric_prefix(const std::string& prefix);
120 ThreadPoolBuilder& set_min_threads(int min_threads);
121 ThreadPoolBuilder& set_max_threads(int max_threads);
122 ThreadPoolBuilder& set_max_queue_size(int max_queue_size);
123 ThreadPoolBuilder& set_idle_timeout(const MonoDelta& idle_timeout);
124 ThreadPoolBuilder& set_queue_overload_threshold(const MonoDelta& threshold);
125 ThreadPoolBuilder& set_metrics(ThreadPoolMetrics metrics);
126 ThreadPoolBuilder& set_enable_scheduler();
127 ThreadPoolBuilder& set_schedule_period_ms(uint32_t schedule_period_ms);
128
129 // Instantiate a new ThreadPool with the existing builder arguments.
130 Status Build(std::unique_ptr<ThreadPool>* pool) const;
131
132 private:
133 friend class ThreadPool;
134 const std::string name_;
135 std::string trace_metric_prefix_;
136 int min_threads_;
137 int max_threads_;
138 int max_queue_size_;
139 MonoDelta idle_timeout_;
140 MonoDelta queue_overload_threshold_;
141 ThreadPoolMetrics metrics_;
142 bool enable_scheduler_;
143 uint32_t schedule_period_ms_ = 100;
144
145 DISALLOW_COPY_AND_ASSIGN(ThreadPoolBuilder);
146};
147
148// SchedulerThread for asynchronized delay task execution.
149//

Callers 10

MessengerMethod · 0.85
SetUpMethod · 0.85
RebuildPoolWithMinMaxMethod · 0.85
TEST_FFunction · 0.85
TEST_PFunction · 0.85
MaintenanceManagerMethod · 0.85
TESTFunction · 0.85
TESTFunction · 0.85
DnsResolverMethod · 0.85

Calls

no outgoing calls

Tested by 7

SetUpMethod · 0.68
RebuildPoolWithMinMaxMethod · 0.68
TEST_FFunction · 0.68
TEST_PFunction · 0.68
TESTFunction · 0.68
TESTFunction · 0.68