Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Duplicate
-
None
-
None
-
None
Description
When a thread notifies event service to process any event, it should have a way to wait for it to be finished.
LensEvent event = new LensEvent(); synchronized(event) { eventservice.notifyEvent(event); event.wait(); }
The EventHandler will do a notifyall() on the event it is done handling.
public void run() { try { Class<? extends LensEvent> evtClass = event.getClass(); // Call listeners directly listening for this event type handleEvent(eventListeners.get(evtClass), event); Class<?> superClass = evtClass.getSuperclass(); // Call listeners which listen of super types of this event type while (LensEvent.class.isAssignableFrom(superClass)) { if (eventListeners.containsKey(superClass)) { handleEvent(eventListeners.get(superClass), event); } superClass = superClass.getSuperclass(); } } finally { synchronized (event) { event.notifyAll(); } } }
Attachments
Issue Links
- is duplicated by
-
LENS-1298 Thread should have ability to wait for Events to be processed
- Resolved