Repository: falcon
Updated Branches:
  refs/heads/0.9 1fb294fbe -> 44f15153b


FALCON-1754 JobCompletionService throws FalconException (By Pallavi Rao)


Project: http://git-wip-us.apache.org/repos/asf/falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/falcon/commit/44f15153
Tree: http://git-wip-us.apache.org/repos/asf/falcon/tree/44f15153
Diff: http://git-wip-us.apache.org/repos/asf/falcon/diff/44f15153

Branch: refs/heads/0.9
Commit: 44f15153b4cc8b7d5b8878f86a78f90bc0f0e8bc
Parents: 1fb294f
Author: Pallavi Rao <[email protected]>
Authored: Fri Jan 22 18:09:45 2016 +0530
Committer: Pallavi Rao <[email protected]>
Committed: Fri Jan 22 18:09:45 2016 +0530

----------------------------------------------------------------------
 CHANGES.txt                                                 | 2 ++
 .../org/apache/falcon/execution/FalconExecutionService.java | 6 ++++--
 .../notification/service/impl/JobCompletionService.java     | 9 ++++++++-
 3 files changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/falcon/blob/44f15153/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index dabc4df..790f7e5 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -106,6 +106,8 @@ Release Version: 0.9
   OPTIMIZATIONS
 
   BUG FIXES
+    FALCON-1754 JobCompletionService throws FalconException (Pallavi Rao)
+
     FALCON-1716 API fails with CommunicationsException when mysql interaction 
time is longer than 53,434,939 milliseconds (Pavan Kolamuri via Pallavi Rao)
 
     FALCON-1757 EntityNotRegisteredException when entity is deleted from 
falcon (Pavan Kolamuri via Pallavi Rao)

http://git-wip-us.apache.org/repos/asf/falcon/blob/44f15153/scheduler/src/main/java/org/apache/falcon/execution/FalconExecutionService.java
----------------------------------------------------------------------
diff --git 
a/scheduler/src/main/java/org/apache/falcon/execution/FalconExecutionService.java
 
b/scheduler/src/main/java/org/apache/falcon/execution/FalconExecutionService.java
index 7bdcd6f..da1d7cc 100644
--- 
a/scheduler/src/main/java/org/apache/falcon/execution/FalconExecutionService.java
+++ 
b/scheduler/src/main/java/org/apache/falcon/execution/FalconExecutionService.java
@@ -19,6 +19,7 @@
 package org.apache.falcon.execution;
 
 import org.apache.falcon.FalconException;
+import org.apache.falcon.entity.EntityNotRegisteredException;
 import org.apache.falcon.entity.EntityUtil;
 import org.apache.falcon.entity.v0.Entity;
 import org.apache.falcon.entity.v0.process.Process;
@@ -125,8 +126,9 @@ public final class FalconExecutionService implements 
FalconService, EntityStateC
         if (id != null) {
             EntityExecutor executor = executors.get(id);
             if (executor == null) {
-                // The executor has gone away, throw an exception so the 
notification service knows
-                throw new FalconException("Target executor for " + 
event.getTarget() + " does not exist.");
+                // The executor has gone away or entity was not scheduled on 
native scheduler,
+                // throw an exception so the notification service knows.
+                throw new EntityNotRegisteredException("Target executor for " 
+ event.getTarget() + " does not exist.");
             }
             executor.onEvent(event);
         }

http://git-wip-us.apache.org/repos/asf/falcon/blob/44f15153/scheduler/src/main/java/org/apache/falcon/notification/service/impl/JobCompletionService.java
----------------------------------------------------------------------
diff --git 
a/scheduler/src/main/java/org/apache/falcon/notification/service/impl/JobCompletionService.java
 
b/scheduler/src/main/java/org/apache/falcon/notification/service/impl/JobCompletionService.java
index 4278d3f..cfebf1c 100644
--- 
a/scheduler/src/main/java/org/apache/falcon/notification/service/impl/JobCompletionService.java
+++ 
b/scheduler/src/main/java/org/apache/falcon/notification/service/impl/JobCompletionService.java
@@ -21,6 +21,7 @@ import java.util.Comparator;
 import java.util.TreeSet;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.falcon.FalconException;
+import org.apache.falcon.entity.EntityNotRegisteredException;
 import org.apache.falcon.entity.EntityUtil;
 import org.apache.falcon.entity.v0.EntityType;
 import org.apache.falcon.exception.NotificationServiceException;
@@ -153,7 +154,13 @@ public class JobCompletionService implements 
FalconNotificationService, Workflow
             while(iterator.hasNext()) {
                 NotificationHandler handler = iterator.next();
                 LOG.debug("Notifying {} with event {}", handler, 
event.getTarget());
-                handler.onEvent(event);
+                try {
+                    handler.onEvent(event);
+                } catch (EntityNotRegisteredException ee) {
+                    // Do nothing if entity no longer exists.
+                } catch (FalconException e) {
+                    LOG.error("Handler threw an exception for target " + 
event.getTarget(), e);
+                }
             }
         }
     }

Reply via email to