Added possibility to use Kernel as j2ee context listener

This commit is contained in:
Viktor Klang 2009-12-22 20:06:04 +01:00
parent d9c58388a9
commit 41a90d041d

View file

@ -9,6 +9,8 @@ import se.scalablesolutions.akka.remote.{RemoteNode,BootableRemoteActorService}
import se.scalablesolutions.akka.util.Logging
import se.scalablesolutions.akka.actor.{ActorRegistry,BootableActorLoaderService}
import javax.servlet.{ServletContextListener,ServletContextEvent}
/**
* The Akka Kernel.
*
@ -71,4 +73,13 @@ object Kernel extends Logging {
log.info(" Running version %s", VERSION)
log.info("==============================")
}
}
}
/*
And this one can be added to web.xml mappings as a listener to boot and shutdown Akka
*/
class Kernel extends ServletContextListener {
def contextDestroyed(e : ServletContextEvent) : Unit = Kernel.shutdown
def contextInitialized(e : ServletContextEvent) : Unit = Kernel.boot
}