DATAREDIS-1097 - Improve synchronization on failure in StreamMessageListenerContainer.

Perform cancellation first, then notify the error handler to avoid race contions such as a notified error handler while the container is still active.
This commit is contained in:
Mark Paluch
2020-02-11 11:11:39 +01:00
parent e62ecbb1a9
commit 19d7a30143

View File

@@ -148,11 +148,11 @@ class StreamPollTask<K, V extends Record<K, ?>> implements Task {
Thread.currentThread().interrupt();
} catch (RuntimeException e) {
errorHandler.handleError(e);
if (cancelSubscriptionOnError.test(e)) {
cancel();
}
errorHandler.handleError(e);
}
} while (pollState.isSubscriptionActive());
}