Skip to content

Instantly share code, notes, and snippets.

@derekjw
Created October 25, 2010 18:38
Show Gist options
  • Save derekjw/645456 to your computer and use it in GitHub Desktop.
Save derekjw/645456 to your computer and use it in GitHub Desktop.
Extra commands to shutdown Akka and release all references to the ClassLoader
// Shutdown HawtDispatch GlobalQueue
org.fusesource.hawtdispatch.ScalaDispatch.globalQueue.asInstanceOf[org.fusesource.hawtdispatch.internal.GlobalDispatchQueue].shutdown
// Clear Thread.subclassAudits
val tf = classOf[java.lang.Thread].getDeclaredField("subclassAudits")
tf.setAccessible(true)
val subclassAudits = tf.get(null).asInstanceOf[java.util.Map[_,_]]
subclassAudits.synchronized {subclassAudits.clear}
// Clear and reset j.u.l.Level.known (due to Configgy)
val lf = classOf[java.util.logging.Level].getDeclaredField("known")
lf.setAccessible(true)
val known = lf.get(null).asInstanceOf[java.util.ArrayList[java.util.logging.Level]]
known.synchronized {
known.clear
known.add(java.util.logging.Level.OFF)
known.add(java.util.logging.Level.SEVERE)
known.add(java.util.logging.Level.WARNING)
known.add(java.util.logging.Level.INFO)
known.add(java.util.logging.Level.CONFIG)
known.add(java.util.logging.Level.FINE)
known.add(java.util.logging.Level.FINER)
known.add(java.util.logging.Level.FINEST)
known.add(java.util.logging.Level.ALL)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment