Я бы рекомендовал использовать Executors#cachedThreadPool
, если размер клиентов не определен.
Документация Executors#cachedThreadPool
:
* Creates a thread pool that creates new threads as needed, but
* will reuse previously constructed threads when they are
* available. These pools will typically improve the performance
* of programs that execute many short-lived asynchronous tasks.
* Calls to {@code execute} will reuse previously constructed
* threads if available. If no existing thread is available, a new
* thread will be created and added to the pool. Threads that have
* not been used for sixty seconds are terminated and removed from
* the cache. Thus, a pool that remains idle for long enough will
* not consume any resources.
Документация Executors#fixedThreadPool
:
* Creates a thread pool that reuses a fixed number of threads
* operating off a shared unbounded queue. At any point, at most
* {@code nThreads} threads will be active processing tasks.
* If additional tasks are submitted when all threads are active,
* they will wait in the queue until a thread is available.
Так что, если вы не уверены, что именно вам, например, нужно 5 потоков, вам не следует использовать Executors#fixedThreadPool
.