diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/MultiplexedSessionDatabaseClient.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/MultiplexedSessionDatabaseClient.java index e742481be2c..e15fdaf6393 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/MultiplexedSessionDatabaseClient.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/MultiplexedSessionDatabaseClient.java @@ -390,11 +390,14 @@ public ReadOnlyTransaction readOnlyTransaction(TimestampBound bound) { /** * It is enough with one executor to maintain the multiplexed sessions in all the clients, as they - * do not need to be updated often, and the maintenance task is light. + * do not need to be updated often, and the maintenance task is light. The core pool size is set + * to 1 to prevent continuous creating and tearing down threads, and to avoid high CPU usage when + * running on Java 8 due to + * https://bugs.openjdk.org/browse/JDK-8129861. */ private static final ScheduledExecutorService MAINTAINER_SERVICE = Executors.newScheduledThreadPool( - /* corePoolSize = */ 0, + /* corePoolSize = */ 1, ThreadFactoryUtil.createVirtualOrPlatformDaemonThreadFactory( "multiplexed-session-maintainer", /* tryVirtual = */ false));