Skip to content

fix: Make sure that XXXResponseSpec instances can only be used once #3886

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

YunKuiLu
Copy link
Contributor

  • Add an AtomicBoolean to DefaultCallResponseSpec and DefaultStreamResponseSpec to track whether the instance has been used
  • Check if the instance has already been used before calling advisorChain.nextCall, and throw an IllegalStateException if it has
  • Add unit tests to confirm that case

Based on issue #3880, we could add checks to detect if methods in DefaultCallResponseSpec and DefaultStreamResponseSpec are called more than once, and throw a clear exception to help with debugging.

- Add an `AtomicBoolean` to DefaultCallResponseSpec and DefaultStreamResponseSpec to track whether the instance has been used
- Check if the instance has already been used before calling `advisorChain.nextCall`, and throw an `IllegalStateException` if it has
- Add unit tests to confirm that case

Signed-off-by: YunKui Lu <luyunkui95@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant