Source:
<code>public ExchangeClientFactory( DataSize maxBufferedBytes, DataSize maxResponseSize, int concurrentRequestMultiplier, Duration minErrorDuration, Duration maxErrorDuration, int pageBufferClientMaxCallbackThreads, HttpClient httpClient, ScheduledExecutorService scheduler) { this.maxBufferedBytes = requireNonNull(maxBufferedBytes, "maxBufferedBytes is null"); this.concurrentRequestMultiplier = concurrentRequestMultiplier; this.minErrorDuration = requireNonNull(minErrorDuration, "minErrorDuration is null"); this.maxErrorDuration = requireNonNull(maxErrorDuration, "maxErrorDuration is null"); this.httpClient = requireNonNull(httpClient, "httpClient is null"); requireNonNull(maxResponseSize, "maxResponseSize is null"); long maxResponseSizeBytes = (long) (Math.min(httpClient.getMaxContentLength(), maxResponseSize.toBytes()) * 0.75); this.maxResponseSize = new DataSize(maxResponseSizeBytes, BYTE); this.scheduler = requireNonNull(scheduler, "scheduler is null"); this.pageBufferClientCallbackExecutor = newCachedThreadPool(daemonThreadsNamed("page-buffer-client-callback-%s")); <START> this.boundedExecutor = new BoundedExecutor(pageBufferClientCallbackExecutor, pageBufferClientMaxCallbackThreads); <END> this.executorMBean = new ThreadPoolExecutorMBean((ThreadPoolExecutor) pageBufferClientCallbackExecutor); checkArgument(maxBufferedBytes.toBytes() > 0, "maxBufferSize must be at least 1 byte: %s", maxBufferedBytes); checkArgument(maxResponseSize.toBytes() > 0, "maxResponseSize must be at least 1 byte: %s", maxResponseSize); checkArgument(concurrentRequestMultiplier > 0, "concurrentRequestMultiplier must be at least 1: %s", concurrentRequestMultiplier); }</code><technical_language>I allocate a fixed pool (there 25 default), scaling a thread pool load is expensive fail</technical_language>

Target:
public ExchangeClientFactory( DataSize maxBufferedBytes, DataSize maxResponseSize, int concurrentRequestMultiplier, Duration minErrorDuration, Duration maxErrorDuration, int pageBufferClientMaxCallbackThreads, HttpClient httpClient, ScheduledExecutorService scheduler) { this.maxBufferedBytes = requireNonNull(maxBufferedBytes, "maxBufferedBytes is null"); this.concurrentRequestMultiplier = concurrentRequestMultiplier; this.minErrorDuration = requireNonNull(minErrorDuration, "minErrorDuration is null"); this.maxErrorDuration = requireNonNull(maxErrorDuration, "maxErrorDuration is null"); this.httpClient = requireNonNull(httpClient, "httpClient is null"); requireNonNull(maxResponseSize, "maxResponseSize is null"); long maxResponseSizeBytes = (long) (Math.min(httpClient.getMaxContentLength(), maxResponseSize.toBytes()) * 0.75); this.maxResponseSize = new DataSize(maxResponseSizeBytes, BYTE); this.scheduler = requireNonNull(scheduler, "scheduler is null"); this.pageBufferClientCallbackExecutor = newFixedThreadPool(pageBufferClientMaxCallbackThreads, daemonThreadsNamed("page-buffer-client-callback-%s")); this.boundedExecutor = new BoundedExecutor(pageBufferClientCallbackExecutor, pageBufferClientMaxCallbackThreads); this.executorMBean = new ThreadPoolExecutorMBean((ThreadPoolExecutor) pageBufferClientCallbackExecutor); checkArgument(maxBufferedBytes.toBytes() > 0, "maxBufferSize must be at least 1 byte: %s", maxBufferedBytes); checkArgument(maxResponseSize.toBytes() > 0, "maxResponseSize must be at least 1 byte: %s", maxResponseSize); checkArgument(concurrentRequestMultiplier > 0, "concurrentRequestMultiplier must be at least 1: %s", concurrentRequestMultiplier); }