Skip to content

Commit 0111c34

Browse files
committed
Fix issues
1 parent 7c41008 commit 0111c34

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

events/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Events module
2+
3+
This module provides a generic events management system.
4+
5+
Allows the definition of internal and external events interdependencies, as well as registration.

events/src/main/java/io/harness/events/EventsManagerCore.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,11 @@ public boolean eventAlreadyTriggered(E event) {
104104
try {
105105
mProcessQueue.execute(latch::countDown);
106106
latch.await();
107-
} catch (RejectedExecutionException | InterruptedException e) {
108-
// If executor is shut down or interrupted, just check current state
107+
} catch (RejectedExecutionException e) {
108+
// Executor is shut down
109+
} catch (InterruptedException e) {
110+
// Restore interrupt status; check current state
111+
Thread.currentThread().interrupt();
109112
}
110113

111114
synchronized (mLock) {

events/src/test/java/io/harness/events/EventsManagerTest.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,6 @@ public void orderTimedOutIsSuppressedWhenDishServedFires() throws InterruptedExc
222222
// ORDER_TIMED_OUT should be suppressed
223223
eventsManager.notifyInternalEvent(KitchenActivity.TIMEOUT_REACHED, null);
224224

225-
// Give some time for potential (incorrect) processing
226-
Thread.sleep(100);
227-
228225
assertEquals(0, timeoutCount.get());
229226
assertFalse(eventsManager.eventAlreadyTriggered(CookingEvent.ORDER_TIMED_OUT));
230227
}

0 commit comments

Comments
 (0)