Skip to content

Commit

Permalink
[fix][metadata] Handle session events in separate thread (apache#17638)
Browse files Browse the repository at this point in the history
(cherry picked from commit 69f3f74)
  • Loading branch information
lhotari authored and nicoloboschi committed Oct 4, 2022
1 parent f1e697d commit 424b950
Showing 1 changed file with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -292,14 +292,19 @@ public void registerSessionListener(Consumer<SessionEvent> listener) {

protected void receivedSessionEvent(SessionEvent event) {
isConnected = event.isConnected();

sessionListeners.forEach(l -> {
try {
l.accept(event);
} catch (Throwable t) {
log.warn("Error in processing session event", t);
}
});
try {
executor.execute(() -> {
sessionListeners.forEach(l -> {
try {
l.accept(event);
} catch (Throwable t) {
log.warn("Error in processing session event " + event, t);
}
});
});
} catch (RejectedExecutionException e) {
log.warn("Error in processing session event " + event, e);
}
}

@Override
Expand Down

0 comments on commit 424b950

Please sign in to comment.