Repository: falcon Updated Branches: refs/heads/master 3251e3aa1 -> 6c787783b
FALCON-1825 Process end time not exclusive in case of Native Scheduler Author: pavankumar526 <[email protected]> Reviewers: "Pallavi Rao <[email protected]>" Closes #59 from pavankumar526/FALCON-1825 Project: http://git-wip-us.apache.org/repos/asf/falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/falcon/commit/6c787783 Tree: http://git-wip-us.apache.org/repos/asf/falcon/tree/6c787783 Diff: http://git-wip-us.apache.org/repos/asf/falcon/diff/6c787783 Branch: refs/heads/master Commit: 6c787783bb3c150b3b913d7b65243086c1d69d61 Parents: 3251e3a Author: pavankumar526 <[email protected]> Authored: Fri Mar 4 17:42:22 2016 +0530 Committer: pavankumar526 <[email protected]> Committed: Fri Mar 4 17:42:22 2016 +0530 ---------------------------------------------------------------------- .../apache/falcon/notification/service/impl/AlarmService.java | 4 ++-- .../org/apache/falcon/notification/service/AlarmServiceTest.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/falcon/blob/6c787783/scheduler/src/main/java/org/apache/falcon/notification/service/impl/AlarmService.java ---------------------------------------------------------------------- diff --git a/scheduler/src/main/java/org/apache/falcon/notification/service/impl/AlarmService.java b/scheduler/src/main/java/org/apache/falcon/notification/service/impl/AlarmService.java index 115f310..b9cbcd7 100644 --- a/scheduler/src/main/java/org/apache/falcon/notification/service/impl/AlarmService.java +++ b/scheduler/src/main/java/org/apache/falcon/notification/service/impl/AlarmService.java @@ -87,7 +87,7 @@ public class AlarmService implements FalconNotificationService { DateTime nextStartTime = request.getStartTime(); DateTime endTime; if (request.getEndTime().isBefore(currentTime)) { - endTime = request.getEndTime(); + endTime = request.getEndTime().minusMinutes(1); } else { endTime = currentTime; } @@ -109,7 +109,7 @@ public class AlarmService implements FalconNotificationService { } } // All past events have been scheduled. Nothing to schedule in the future. - if (request.getEndTime().isBefore(nextStartTime)) { + if (endTime.isBefore(nextStartTime)) { return; } LOG.debug("Scheduling to trigger events from {} to {} with frequency {}", nextStartTime, request.getEndTime(), http://git-wip-us.apache.org/repos/asf/falcon/blob/6c787783/scheduler/src/test/java/org/apache/falcon/notification/service/AlarmServiceTest.java ---------------------------------------------------------------------- diff --git a/scheduler/src/test/java/org/apache/falcon/notification/service/AlarmServiceTest.java b/scheduler/src/test/java/org/apache/falcon/notification/service/AlarmServiceTest.java index 34965f2..a8e31bc 100644 --- a/scheduler/src/test/java/org/apache/falcon/notification/service/AlarmServiceTest.java +++ b/scheduler/src/test/java/org/apache/falcon/notification/service/AlarmServiceTest.java @@ -69,7 +69,7 @@ public class AlarmServiceTest { timeService.register(request.build()); // Asynchronous execution, hence a small wait. - Thread.sleep(1000); + Thread.sleep(2000); // Based on the minute boundary, there might be 3. Mockito.verify(handler, Mockito.atLeast(2)).onEvent(Mockito.any(Event.class));
