Skip to content

Commit a5c62aa

Browse files
committed
checksum-dependency: reduce the number of idle threads
Previously, Executors.newFixedThreadPool created all the threads upfront
1 parent 08e0523 commit a5c62aa

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ This library is distributed under terms of Apache License 2.0
8787

8888
Change log
8989
----------
90+
v1.89
91+
* checksum-dependency: reduce the number of idle threads
92+
9093
v1.88
9194
* stage-vote-release: avoid failures when "init" does not exist
9295
* chore: fixed build warnings

plugins/checksum-dependency-plugin/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,9 @@ Verification options
501501

502502
Changelog
503503
---------
504+
v1.89
505+
* Reduce the number of idle threads
506+
504507
v1.88
505508
* Infer artifact classifier from the file name
506509
* Copy requested attributes to the configuration that resolves PGP signatures

plugins/checksum-dependency-plugin/src/main/kotlin/com/github/vlsi/gradle/checksum/Executors.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
package com.github.vlsi.gradle.checksum
1818

1919
import java.util.concurrent.ExecutorService
20-
import java.util.concurrent.Executors
20+
import java.util.concurrent.LinkedBlockingQueue
21+
import java.util.concurrent.ThreadPoolExecutor
22+
import java.util.concurrent.TimeUnit
2123
import java.util.concurrent.atomic.AtomicInteger
2224

2325
class Executors(val cpu: ExecutorService, val io: ExecutorService) {
@@ -27,7 +29,11 @@ class Executors(val cpu: ExecutorService, val io: ExecutorService) {
2729

2830
private fun pool(threads: Int, name: String): ExecutorService {
2931
val cnt = AtomicInteger()
30-
return Executors.newFixedThreadPool(threads) {
32+
return ThreadPoolExecutor(
33+
0, threads,
34+
20L, TimeUnit.SECONDS,
35+
LinkedBlockingQueue()
36+
) { it: Runnable ->
3137
Thread(it).apply {
3238
this.name = name + cnt.getAndIncrement()
3339
}

0 commit comments

Comments
 (0)