mirror of https://github.com/sbt/sbt.git
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:
commit
16e14f1757
|
|
@ -100,9 +100,12 @@ private[sbt] abstract class AbstractBackgroundJobService extends BackgroundJobSe
|
||||||
val workingDirectory: File,
|
val workingDirectory: File,
|
||||||
val job: BackgroundJob
|
val job: BackgroundJob
|
||||||
) extends AbstractJobHandle {
|
) extends AbstractJobHandle {
|
||||||
implicit val executionContext: ExecutionContext = StandardMain.executionContext
|
|
||||||
def humanReadableName: String = job.humanReadableName
|
|
||||||
// EC for onStop handler below
|
// EC for onStop handler below
|
||||||
|
implicit val executionContext: ExecutionContext =
|
||||||
|
ExecutionContext.fromExecutor(pool.executor)
|
||||||
|
|
||||||
|
def humanReadableName: String = job.humanReadableName
|
||||||
|
|
||||||
job.onStop { () =>
|
job.onStop { () =>
|
||||||
// TODO: Fix this
|
// TODO: Fix this
|
||||||
// logger.close()
|
// 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 */
|
0, /* corePoolSize */
|
||||||
32, /* maxPoolSize, max # of bg tasks */
|
32, /* maxPoolSize, max # of bg tasks */
|
||||||
2,
|
2,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue