fixing a screwy merge from master... readding files git deleted for some unknown reason

This commit is contained in:
Garrick Evans 2010-11-20 23:41:40 -08:00
parent 1a23d36297
commit adf8b63469
7 changed files with 818 additions and 208 deletions

View file

@ -0,0 +1,77 @@
/**
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
*/
package akka.servlet
import akka.config.Config
import akka.util.{Logging, Bootable}
import akka.actor.Actor
/*
* This class is responsible for booting up a stack of bundles and then shutting them down
*/
class AkkaLoader extends Logging {
@volatile private var hasBooted = false
@volatile private var _bundles: Option[Bootable] = None
def bundles = _bundles;
/*
* Boot initializes the specified bundles
*/
def boot(withBanner: Boolean, b : Bootable): Unit = synchronized {
if (!hasBooted) {
if (withBanner) printBanner
log.info("Starting Akka...")
b.onLoad
Thread.currentThread.setContextClassLoader(getClass.getClassLoader)
log.info("Akka started successfully")
hasBooted = true
_bundles = Some(b)
}
}
/*
* Shutdown, well, shuts down the bundles used in boot
*/
def shutdown = synchronized {
if (hasBooted) {
log.info("Shutting down Akka...")
_bundles.foreach(_.onUnload)
_bundles = None
Actor.shutdownHook.run
log.info("Akka succesfully shut down")
}
}
private def printBanner = {
log.info("==================================================")
log.info(" t")
log.info(" t t t")
log.info(" t t tt t")
log.info(" tt t t tt t")
log.info(" t ttttttt t ttt t")
log.info(" t tt ttt t ttt t")
log.info(" t t ttt t ttt t t")
log.info(" tt t ttt ttt ttt t")
log.info(" t t ttt ttt t tt t")
log.info(" t ttt ttt t t")
log.info(" tt ttt ttt t")
log.info(" ttt ttt")
log.info(" tttttttt ttt ttt ttt ttt tttttttt")
log.info(" ttt tt ttt ttt ttt ttt ttt ttt")
log.info(" ttt ttt ttt ttt ttt ttt ttt ttt")
log.info(" ttt ttt ttt ttt ttt tt ttt ttt")
log.info(" tttt ttttttttt tttttttt tttt")
log.info(" ttttttttt ttt ttt ttt ttt ttttttttt")
log.info(" ttt ttt ttt ttt ttt ttt ttt ttt")
log.info(" ttt ttt ttt ttt ttt ttt ttt ttt")
log.info(" ttt tt ttt ttt ttt ttt ttt ttt")
log.info(" tttttttt ttt ttt ttt ttt tttttttt")
log.info("==================================================")
log.info(" Running version %s", Config.VERSION)
log.info("==================================================")
}
}