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:
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user