File tree 1 file changed +5
-2
lines changed
google-cloud-spanner/src/main/java/com/google/cloud/spanner
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -390,11 +390,14 @@ public ReadOnlyTransaction readOnlyTransaction(TimestampBound bound) {
390
390
391
391
/**
392
392
* It is enough with one executor to maintain the multiplexed sessions in all the clients, as they
393
- * do not need to be updated often, and the maintenance task is light.
393
+ * do not need to be updated often, and the maintenance task is light. The core pool size is set
394
+ * to 1 to prevent continuous creating and tearing down threads, and to avoid high CPU usage when
395
+ * running on Java 8 due to <a href="https://bugs.openjdk.org/browse/JDK-8129861">
396
+ * https://bugs.openjdk.org/browse/JDK-8129861</a>.
394
397
*/
395
398
private static final ScheduledExecutorService MAINTAINER_SERVICE =
396
399
Executors .newScheduledThreadPool (
397
- /* corePoolSize = */ 0 ,
400
+ /* corePoolSize = */ 1 ,
398
401
ThreadFactoryUtil .createVirtualOrPlatformDaemonThreadFactory (
399
402
"multiplexed-session-maintainer" , /* tryVirtual = */ false ));
400
403
You can’t perform that action at this time.
0 commit comments