notify with call-by-name included again
This commit is contained in:
parent
a885c09354
commit
e8ee6b321a
1 changed files with 16 additions and 3 deletions
|
|
@ -94,10 +94,15 @@ object EventHandler extends ListenerManagement {
|
|||
"Configuration option 'akka.event-handler-level' is invalid [" + unknown + "]")
|
||||
}
|
||||
|
||||
def notify(event: Any) { notifyListeners(event) }
|
||||
def notify(event: Any) {
|
||||
if (event.isInstanceOf[Event]) {
|
||||
if (level >= event.asInstanceOf[Event].level) notifyListeners(event)
|
||||
} else
|
||||
notifyListeners(event)
|
||||
}
|
||||
|
||||
def notify(event: Event) {
|
||||
if (level >= event.level) notifyListeners(event)
|
||||
def notify[T <: Event : ClassManifest](event: => T) {
|
||||
if (level >= levelFor(classManifest[T].erasure.asInstanceOf[Class[_ <: Event]])) notifyListeners(event)
|
||||
}
|
||||
|
||||
def error(cause: Throwable, instance: AnyRef, message: => String) {
|
||||
|
|
@ -149,6 +154,14 @@ object EventHandler extends ListenerManagement {
|
|||
sw.toString
|
||||
}
|
||||
|
||||
private def levelFor(eventClass: Class[_ <: Event]) = {
|
||||
if (eventClass.isInstanceOf[Error]) ErrorLevel
|
||||
else if (eventClass.isInstanceOf[Warning]) WarningLevel
|
||||
else if (eventClass.isInstanceOf[Info]) InfoLevel
|
||||
else if (eventClass.isInstanceOf[Debug]) DebugLevel
|
||||
else DebugLevel
|
||||
}
|
||||
|
||||
class DefaultListener extends Actor {
|
||||
self.id = ID
|
||||
self.dispatcher = EventHandlerDispatcher
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue