Skip to content

Fixing 22325 issue application listeners logic #23782

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

Closed
wants to merge 1 commit into from

Conversation

platonovr
Copy link

There was an issue #22325 and @jhoeller has fixed it, but now I have the following problem: on the application startup there is a call of prepareRefresh(), so it works like that
this.earlyApplicationListeners = new LinkedHashSet<>(this.applicationListeners);
this.applicationListeners is an empty collection.
Then it's needed to refresh the Application Context, app provokes the refresh() at AbstractApplicationContext, then Spring calls prepareRefresh and then checks
this.earlyApplicationListeners == null,
but it's an empty LinkedHashSet, not null, it's zero size set, so then it comes to
this.applicationListeners.clear();
and all the listeners are removed, but they were created, so I'm loosing all of applicationListeners there.
Application listeners collection was filled by CXF Servlet code

Don't loose the application listeners, if early set was empty.
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Oct 11, 2019
@rstoyanchev rstoyanchev added the in: core Issues in core modules (aop, beans, core, context, expression) label Nov 11, 2021
@snicoll
Copy link
Member

snicoll commented Aug 23, 2023

@platonovr unfortunately it's hard for us to judge the problem at hand without test cases that demonstrate the problem you've described. Looking at the code you've referenced, you should call addApplicationListener rather than the reflection-based code.

Please amend your PR with some tests that are failing before your change.

@snicoll snicoll added the status: waiting-for-feedback We need additional information before we can continue label Aug 23, 2023
@pivotal-cla
Copy link

@platonovr Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Aug 23, 2023
@snicoll snicoll added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Aug 23, 2023
@snicoll
Copy link
Member

snicoll commented Sep 11, 2023

I am going to close this now for the reason outlined above. If the feedback is provided, we can reopen this PR and continue the review.

@snicoll snicoll closed this Sep 11, 2023
@snicoll snicoll removed status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged or decided on labels Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants