Skip to content

Commit

Permalink
Signal shutdown via nailgun common pool in exit
Browse files Browse the repository at this point in the history
  • Loading branch information
jvican committed Jan 15, 2019
1 parent 8957aec commit aeeced4
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions frontend/src/main/scala/bloop/Server.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,17 @@ object Server {

def nailMain(ngContext: NGContext): Unit = {
val server = ngContext.getNGServer
shutDown(server)
import java.util.concurrent.ForkJoinPool

ForkJoinPool
.commonPool()
.submit(new Runnable {
override def run(): Unit = {
server.shutdown(false)
}
})

()
}

private def run(server: NGServer): Unit = {
Expand All @@ -52,7 +62,7 @@ object Server {
new Alias(
"exit",
"Kill the bloop server.",
classOf[com.martiansoftware.nailgun.builtins.NGStop]
classOf[Server]
)
)

Expand All @@ -61,8 +71,4 @@ object Server {
// Disable nails by class name so that we prevent classloading incorrect aliases
server.setAllowNailsByClassName(false)
}

private def shutDown(server: NGServer): Unit = {
server.shutdown( /* exitVM = */ false)
}
}

0 comments on commit aeeced4

Please sign in to comment.