Skip to content
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

Bugfix: Catch RejectedExecutionException and skip validation #13

Merged
merged 7 commits into from
Jun 13, 2023

Conversation

pboos
Copy link
Contributor

@pboos pboos commented Jun 13, 2023

ThreadPoolExecutor.execute can throw RejectedExecutionException. If it does, we just want to ignore it and skip validation for that request. This way we guarantee the request going through in those cases.

@pboos pboos requested review from a team and huguenin June 13, 2023 06:31
Copy link
Member

@dominik-riha dominik-riha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Do you have a test for this?

@pboos
Copy link
Contributor Author

pboos commented Jun 13, 2023

Looks good. Do you have a test for this?

@dominik-riha Now we do 😄

try {
threadPoolExecutor.execute(command);
} catch (RejectedExecutionException ignored) {
// ignored
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to monitor this? It could point to a configuration issue (thread pool too small for the amount of requests handled). If you are not monitoring, you could simply set up the In ThreadPoolExecutor.DiscardPolicy handler instead, see https://stackoverflow.com/questions/8183205/what-could-be-the-cause-of-rejectedexecutionexception

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now not planning to monitor. Maybe later? Added DiscardPolicy now. Still leaving RejectedExecutionException just for safety :)

@pboos pboos merged commit 22f09c7 into main Jun 13, 2023
@pboos pboos deleted the bugfix/skip-validation-on-exception branch June 13, 2023 10:13
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.

3 participants