Skip to content

Commit

Permalink
[grid] Ignoring NoSuchSessionException in SESSION_CLOSED event listen…
Browse files Browse the repository at this point in the history
…er on a node.

This exception is thrown if the session with the given id does not exist on this node. When a node stops the session on driver.quit() call it notifies all the parties by sending SESSION_CLOSED event to MQ. The distributor handles this event and commands the "local node" to stop the session. But if the distributor and the node are working in the same process the session is already closed on the "local node" and it throws. Ignoring this exception looks safe because we can't do (and shouldn't do) anything in this case.
  • Loading branch information
barancev committed Apr 5, 2019
1 parent 324942a commit 7a7734c
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ private LocalNode(
this.regularly = new Regularly("Local Node: " + externalUri);
regularly.submit(currentSessions::cleanUp, Duration.ofSeconds(30), Duration.ofSeconds(30));

bus.addListener(SESSION_CLOSED, event -> this.stop(event.getData(SessionId.class)));
bus.addListener(SESSION_CLOSED, event -> {
try {
this.stop(event.getData(SessionId.class));
} catch (NoSuchSessionException ignore) {}
});
}

@VisibleForTesting
Expand Down

0 comments on commit 7a7734c

Please sign in to comment.