-
Notifications
You must be signed in to change notification settings - Fork 565
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
Implement metrics for thread pool suppliers (3.0) #3652
Conversation
@@ -202,7 +200,8 @@ private void sendResponse(ServerResponse res, Response response) { | |||
} | |||
} | |||
|
|||
void terminate(@Observes @BeforeDestroyed(ApplicationScoped.class) Object event) { | |||
@PreDestroy | |||
void terminate() { |
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.
Why is this changed?
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.
We had suspicion it gets invoked twice in some hard to replicate cases and agreed to take this pre-emptive action
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.
In my local tests, I was seeing the class instantiated twice. From the stack traces in the debugger is seemed that CDI was instantiating it the second time in order to notify it of the before-destroyed event. Because the logic in the method was simply cleaning up resources allocated by the bean itself (and not really taking action related to the shut-down of other beans), using @PreDestroy
not only resolved the problem I was seeing but also more closely aligned with the work the method was doing.
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.
@tomas-langer Are you OK with this? Was this your only concern? I would like to merge this PR.
Resolves #3639
For description see PR #3630 (2.x)