Skip to content

Commit 34b4bc3

Browse files
authored
fix: Log HttpJson's async thread pool core size (#2697)
Fixes #2680
1 parent 208bef4 commit 34b4bc3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

gax-java/gax/src/main/java/com/google/api/gax/core/InstantiatingExecutorProvider.java

+7
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,18 @@
3434
import java.util.concurrent.ScheduledThreadPoolExecutor;
3535
import java.util.concurrent.ThreadFactory;
3636
import java.util.concurrent.atomic.AtomicInteger;
37+
import java.util.logging.Level;
38+
import java.util.logging.Logger;
3739

3840
/**
3941
* InstantiatingChannelProvider is an ExecutorProvider which constructs a new
4042
* ScheduledExecutorService every time getExecutor() is called.
4143
*/
4244
@AutoValue
4345
public abstract class InstantiatingExecutorProvider implements ExecutorProvider {
46+
private static final Logger LOGGER =
47+
Logger.getLogger(InstantiatingExecutorProvider.class.getName());
48+
4449
// Thread factory to use to create our worker threads
4550
private static final ThreadFactory DEFAULT_THREAD_FACTORY =
4651
new ThreadFactory() {
@@ -95,6 +100,8 @@ public static Builder newBuilder() {
95100
public static Builder newIOBuilder() {
96101
int numCpus = Runtime.getRuntime().availableProcessors();
97102
int numThreads = IO_THREAD_MULTIPLIER * Math.max(MIN_THREAD_AMOUNT, numCpus);
103+
LOGGER.log(
104+
Level.CONFIG, String.format("Thread Pool for requests has Core Pool Size: %d", numThreads));
98105

99106
return new AutoValue_InstantiatingExecutorProvider.Builder()
100107
.setExecutorThreadCount(numThreads)

0 commit comments

Comments
 (0)