| 503 | private: |
| 504 | template <class TThreadPool_> |
| 505 | static THolder<IThreadPool> MakeThreadPool(IThreadFactory* factory, bool elastic, ICallBack* callback = nullptr, const TString& threadName = {}) { |
| 506 | if (!factory) { |
| 507 | factory = SystemThreadFactory(); |
| 508 | } |
| 509 | |
| 510 | THolder<IThreadPool> pool; |
| 511 | const auto params = IThreadPool::TParams().SetFactory(factory).SetThreadName(threadName); |
| 512 | if (callback) { |
| 513 | pool = MakeHolder<TThreadPoolBinder<TThreadPool_, THttpServer::ICallBack>>(callback, params); |
| 514 | } else { |
| 515 | pool = MakeHolder<TThreadPool_>(params); |
| 516 | } |
| 517 | |
| 518 | if (elastic) { |
| 519 | pool = MakeHolder<TElasticQueue>(std::move(pool)); |
| 520 | } |
| 521 | |
| 522 | return pool; |
| 523 | } |
| 524 | }; |
| 525 | |
| 526 | THttpServer::THttpServer(ICallBack* cb, const TOptions& options, IThreadFactory* pool) |
nothing calls this directly
no test coverage detected