Skip to content

Commit

Permalink
Catches listener errors
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanConfluent committed Feb 10, 2020
1 parent ba8c6c9 commit 9c126ea
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,7 @@ private void processHeartbeats(final long windowStart, final long windowEnd) {
}
return status;
});
for (HostStatusListener listener : hostStatusListeners) {
listener.onHostStatusUpdated(getHostsStatus());
}
notifyListeners();
return;
}

Expand Down Expand Up @@ -256,8 +254,16 @@ private void processHeartbeats(final long windowStart, final long windowEnd) {
.withHostAlive(isAlive).withLastStatusUpdateMs(windowEnd));
}
}
notifyListeners();
}

private void notifyListeners() {
for (HostStatusListener listener : hostStatusListeners) {
listener.onHostStatusUpdated(getHostsStatus());
try {
listener.onHostStatusUpdated(getHostsStatus());
} catch (Throwable t) {
LOG.error("Error while notifying listener", t);
}
}
}

Expand Down

0 comments on commit 9c126ea

Please sign in to comment.