Skip to content

Instantly share code, notes, and snippets.

@velvia
Created April 11, 2014 07:42
Show Gist options
  • Select an option

  • Save velvia/10447394 to your computer and use it in GitHub Desktop.

Select an option

Save velvia/10447394 to your computer and use it in GitHub Desktop.
Patch to spark-jobserver to clean up GC
case StopContext(name) =>
if (contexts contains name) {
logger.info("Shutting down context {}", name)
context.watch(contexts(name)) // watch for termination event
contexts(name) ! PoisonPill
contexts.remove(name)
resultActors.remove(name)
sender ! ContextStopped
} else {
sender ! NoSuchContext
}
case Terminated(name) =>
// Child JobManagerActor actually cleaned up
logger.info("context {} cleaned up, invoking GC to free permgen/classes...", name)
// For details see https://github.com/sbt/sbt/issues/1223
System.gc(); java.lang.System.runFinalization(); System.gc()
@velvia
Copy link
Copy Markdown
Author

velvia commented Apr 11, 2014

For LocalContextSupervisorActor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment