Unsubscribe receive if jsonRpcSender channel is closed

This commit is contained in:
AsamK 2022-06-08 17:50:20 +02:00
parent 7bf06aef5e
commit c8cd36bde8
2 changed files with 11 additions and 2 deletions

View file

@ -860,7 +860,8 @@ class ManagerImpl implements Manager {
logger.debug("Starting receiving messages");
context.getReceiveHelper().receiveMessagesContinuously((envelope, e) -> {
synchronized (messageHandlers) {
Stream.concat(messageHandlers.stream(), weakHandlers.stream()).forEach(h -> {
final var handlers = Stream.concat(messageHandlers.stream(), weakHandlers.stream()).toList();
handlers.forEach(h -> {
try {
h.handleMessage(envelope, e);
} catch (Throwable ex) {