If there is no EventHandler listener defined and an empty default config is used then the default listener is now added and used

This commit is contained in:
Jonas Bonér 2011-04-06 13:39:18 +02:00
parent 10ecd8541c
commit 7eaecf96bb
2 changed files with 8 additions and 4 deletions

View file

@ -165,10 +165,14 @@ object EventHandler extends ListenerManagement {
}
}
config.getList("akka.event-handlers") foreach { listenerName =>
val defaultListeners = config.getList("akka.event-handlers") match {
case Nil => "akka.event.EventHandler$DefaultListener" :: Nil
case listeners => listeners
}
defaultListeners foreach { listenerName =>
try {
ReflectiveAccess.getClassFor[Actor](listenerName) map {
clazz => addListener(Actor.actorOf(clazz).start)
ReflectiveAccess.getClassFor[Actor](listenerName) map { clazz =>
addListener(Actor.actorOf(clazz).start)
}
} catch {
case e: Exception =>

View file

@ -56,7 +56,7 @@ object Pi extends App {
// ==================
// ===== Worker =====
// ==================
class Worker() extends Actor {
class Worker extends Actor {
// define the work
/*