Merge pull request #4194 from veera83372/1.1.x

Fix for #4191 (active.json should be removed on JVM shutdown)
This commit is contained in:
eugene yokota 2018-06-13 11:25:18 -04:00 committed by GitHub
commit 51ee6fc409
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -105,11 +105,18 @@ object StandardMain {
import scalacache.caffeine._
private[sbt] lazy val cache: Cache[Any] = CaffeineCache[Any]
private[sbt] val shutdownHook = new Thread(new Runnable {
def run(): Unit = {
exchange.shutdown
}
})
def runManaged(s: State): xsbti.MainResult = {
val previous = TrapExit.installManager()
try {
try {
try {
Runtime.getRuntime.addShutdownHook(shutdownHook)
MainLoop.runLogged(s)
} finally exchange.shutdown
} finally DefaultBackgroundJobService.backgroundJobService.shutdown()