fix leaked non-daemon thread in Downloader

This commit is contained in:
Eugene Petrenko
2017-09-11 12:04:17 +02:00
committed by ilmat192
parent 1186bc22b4
commit b1e84593b5
@@ -12,7 +12,15 @@ class DependencyDownloader(
var maxAttempts: Int = DEFAULT_MAX_ATTEMPTS, var maxAttempts: Int = DEFAULT_MAX_ATTEMPTS,
var attemptIntervalMs: Long = DEFAULT_ATTEMPT_INTERVAL_MS var attemptIntervalMs: Long = DEFAULT_ATTEMPT_INTERVAL_MS
) { ) {
val executor = ExecutorCompletionService<Unit>(Executors.newSingleThreadExecutor()) val executor = ExecutorCompletionService<Unit>(Executors.newSingleThreadExecutor(object : ThreadFactory {
override fun newThread(r: Runnable?): Thread {
val thread = Thread(r)
thread.name = "konan-dependency-downloader"
thread.isDaemon = true
return thread
}
}))
enum class ReplacingMode { enum class ReplacingMode {
/** Redownload the file and replace the existing one. */ /** Redownload the file and replace the existing one. */