Merge pull request #278 from eed3si9n/wip/thread-pool

Use fixed thread pool
This commit is contained in:
eugene yokota 2018-11-06 17:32:59 -05:00 committed by GitHub
commit 4a0a6c77bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -19,8 +19,12 @@ private[ivyint] case class DownloadResult(dep: IvyNode,
totalSizeDownloaded: Long)
object ParallelResolveEngine {
private val resolveExecutionContext =
ExecutionContext.fromExecutor(Executors.newCachedThreadPool())
private lazy val resolveExecutionContext: ExecutionContext = {
// This throttles the connection number, especially when Gigahorse is not used.
val maxConnectionCount = 6
val executor = Executors.newFixedThreadPool(maxConnectionCount)
ExecutionContext.fromExecutor(executor)
}
}
/** Define an ivy [[ResolveEngine]] that resolves dependencies in parallel. */