-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Broker] Fix async response filter #11052
[Broker] Fix async response filter #11052
Conversation
|
||
@Slf4j | ||
public class CounterBrokerInterceptor implements BrokerInterceptor { | ||
|
||
int beforeSendCount = 0; | ||
int count = 0; | ||
private List<ResponseEvent> responseList = new ArrayList<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong,
This list does not support concurrent access.
We should use CopyOnWriteArrayList
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, @gaoran10 Could you please push a PR for fixing this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'll fix it. But this class is used for testing, maybe there is only one admin client for testing in normal cases.
### Motivation Currently, the response filter couldn't process async responses correctlly, the response interceptor may be called before the async response returning. ### Modifications Add listener when using async request. ### Verifying this change Add a new test to verify the response interceptor is called after async response returning. (cherry picked from commit 3c8d210)
### Motivation Currently, the response filter couldn't process async responses correctlly, the response interceptor may be called before the async response returning. ### Modifications Add listener when using async request. ### Verifying this change Add a new test to verify the response interceptor is called after async response returning.
Motivation
Currently, the response filter couldn't process async responses correctlly, the response interceptor may be called before the async response returning.
Modifications
Add listener when using async request.
Verifying this change
Add a new test to verify the response interceptor is called after async response returning.
Does this pull request potentially affect one of the following parts:
If
yes
was chosen, please highlight the changes