mirror of https://github.com/zlatinb/muwire
vetoable events
parent
be9229d24b
commit
e5f585c413
|
@ -7,6 +7,7 @@ class Event {
|
|||
private static final AtomicLong SEQ_NO = new AtomicLong();
|
||||
final long seqNo
|
||||
final long timestamp
|
||||
boolean vetoed
|
||||
|
||||
Event() {
|
||||
seqNo = SEQ_NO.getAndIncrement()
|
||||
|
|
|
@ -31,9 +31,11 @@ class EventBus {
|
|||
synchronized(this) {
|
||||
currentHandlers = handlers.getOrDefault(clazz, [])
|
||||
}
|
||||
currentHandlers.each {
|
||||
for(def handler : currentHandlers) {
|
||||
if (e.vetoed)
|
||||
break
|
||||
try {
|
||||
it."on${clazz.getSimpleName()}"(e)
|
||||
handler."on${clazz.getSimpleName()}"(e)
|
||||
} catch (Exception bad) {
|
||||
log.log(Level.SEVERE, "exception dispatching event",bad)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue