Skip to content

Commit

Permalink
Notify SessionActivityListeners using client executor (#1348)
Browse files Browse the repository at this point in the history
This prevents deadlock when the user makes a blocking call that requires the Session from the SessionFsm.

fixes #1300
  • Loading branch information
kevinherron authored Nov 29, 2024
1 parent 7b966e0 commit 5e413f5
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -593,8 +593,11 @@ public void onStateTransition(
SessionFsm.SessionActivityListeners sessionActivityListeners =
KEY_SESSION_ACTIVITY_LISTENERS.get(ctx);

sessionActivityListeners.sessionActivityListeners
.forEach(listener -> listener.onSessionActive(session));
client.getConfig().getExecutor().execute(
() ->
sessionActivityListeners.sessionActivityListeners
.forEach(listener -> listener.onSessionActive(session))
);
});

// onSessionInactive() callbacks
Expand All @@ -607,8 +610,11 @@ public void onStateTransition(
SessionFsm.SessionActivityListeners sessionActivityListeners =
KEY_SESSION_ACTIVITY_LISTENERS.get(ctx);

sessionActivityListeners.sessionActivityListeners
.forEach(listener -> listener.onSessionInactive(session));
client.getConfig().getExecutor().execute(
() ->
sessionActivityListeners.sessionActivityListeners
.forEach(listener -> listener.onSessionInactive(session))
);
});


Expand Down

0 comments on commit 5e413f5

Please sign in to comment.