Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Log HttpJson's async thread pool core size #2697

Merged
merged 1 commit into from
Apr 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,18 @@
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
* InstantiatingChannelProvider is an ExecutorProvider which constructs a new
* ScheduledExecutorService every time getExecutor() is called.
*/
@AutoValue
public abstract class InstantiatingExecutorProvider implements ExecutorProvider {
private static final Logger LOGGER =
Logger.getLogger(InstantiatingExecutorProvider.class.getName());

// Thread factory to use to create our worker threads
private static final ThreadFactory DEFAULT_THREAD_FACTORY =
new ThreadFactory() {
Expand Down Expand Up @@ -95,6 +100,8 @@ public static Builder newBuilder() {
public static Builder newIOBuilder() {
int numCpus = Runtime.getRuntime().availableProcessors();
int numThreads = IO_THREAD_MULTIPLIER * Math.max(MIN_THREAD_AMOUNT, numCpus);
LOGGER.log(
Level.CONFIG, String.format("Thread Pool for requests has Core Pool Size: %d", numThreads));

return new AutoValue_InstantiatingExecutorProvider.Builder()
.setExecutorThreadCount(numThreads)
Expand Down
Loading