[
https://issues.apache.org/jira/browse/LENS-1298?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15467128#comment-15467128
]
Hudson commented on LENS-1298:
------------------------------
UNSTABLE: Integrated in Jenkins build Lens-Commit-Java8 #249 (See
[https://builds.apache.org/job/Lens-Commit-Java8/249/])
LENS-1298: Thread should have ability to wait for Events to be processed
(rajatgupta59: rev d9911f618f345347f62c20184dc2023e07498bc8)
* (edit)
lens-server-api/src/main/java/org/apache/lens/server/api/events/LensEventService.java
* (edit)
lens-server-api/src/main/java/org/apache/lens/server/api/events/SchedulerAlarmEvent.java
* (edit)
lens-server/src/test/java/org/apache/lens/server/query/TestEventService.java
* (edit)
lens-server/src/main/java/org/apache/lens/server/scheduler/AlarmService.java
* (edit) lens-server/src/main/java/org/apache/lens/server/EventServiceImpl.java
* (edit)
lens-server/src/main/java/org/apache/lens/server/scheduler/SchedulerServiceImpl.java
> Thread should have ability to wait for Events to be processed
> -------------------------------------------------------------
>
> Key: LENS-1298
> URL: https://issues.apache.org/jira/browse/LENS-1298
> Project: Apache Lens
> Issue Type: New Feature
> Reporter: Lavkesh Lahngir
> Assignee: Lavkesh Lahngir
> Fix For: 2.7
>
> Attachments: notifySync.patch
>
>
> When a thread notifies event service to process any event, it should have a
> way to wait for it to be finished.
> {code}
> LensEvent event = new LensEvent();
> synchronized(event) {
> eventservice.notifyEvent(event);
> event.wait();
> }
> {code}
> The EventHandler will do a notifyall() on the event it is done handling.
> {code}
> 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();
> }
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)