Merge pull request #5446 from azolotko/5226-use-backgound-job-service-pool-for-job-onstop

Prevent RejectedExecutionException during BackgroundRunnable.cleanup
This commit is contained in:
eugene yokota 2020-02-24 17:25:15 -05:00 committed by GitHub
commit 16e14f1757
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -100,9 +100,12 @@ private[sbt] abstract class AbstractBackgroundJobService extends BackgroundJobSe
val workingDirectory: File,
val job: BackgroundJob
) extends AbstractJobHandle {
implicit val executionContext: ExecutionContext = StandardMain.executionContext
def humanReadableName: String = job.humanReadableName
// EC for onStop handler below
implicit val executionContext: ExecutionContext =
ExecutionContext.fromExecutor(pool.executor)
def humanReadableName: String = job.humanReadableName
job.onStop { () =>
// TODO: Fix this
// logger.close()
@ -305,7 +308,7 @@ private[sbt] class BackgroundThreadPool extends java.io.Closeable {
}
}
private val executor = new java.util.concurrent.ThreadPoolExecutor(
private[internal] val executor = new java.util.concurrent.ThreadPoolExecutor(
0, /* corePoolSize */
32, /* maxPoolSize, max # of bg tasks */
2,