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

[ISSUE #446] Use strong reference avoid weak references recycled when GC occurs #4872

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

Conversation

zzzk1
Copy link

@zzzk1 zzzk1 commented May 7, 2024

Fixes #446

Motivation

Use strong references to replace the direct use of weak references to avoid NPE problems caused by weak references being restored during system GC occurs

Modifications

Describe the modifications you've done.

Documentation

  • Does this pull request introduce a new feature? (no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
  • If a feature is not applicable for documentation, explain why?
  • If a feature is not documented yet in this PR, please create a followup issue for adding the documentation

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome to the Apache EventMesh community!!
This is your first PR in our project. We're very excited to have you onboard contributing. Your contributions are greatly appreciated!

Please make sure that the changes are covered by tests.
We will be here shortly.
Let us know if you need any help!

Want to get closer to the community?

WeChat Assistant WeChat Public Account Slack
Join Slack Chat

Mailing Lists:

Name Description Subscribe Unsubscribe Archive
Users User support and questions mailing list Subscribe Unsubscribe Mail Archives
Development Development related discussions Subscribe Unsubscribe Mail Archives
Commits All commits to repositories Subscribe Unsubscribe Mail Archives
Issues Issues or PRs comments and reviews Subscribe Unsubscribe Mail Archives

@zzzk1
Copy link
Author

zzzk1 commented May 7, 2024

@Pil0tXia pls take a look

@Pil0tXia Pil0tXia changed the title [ISSUE #446]Use strong reference avoid weak references recycled when GC occurs [ISSUE #446] Use strong reference avoid weak references recycled when GC occurs May 7, 2024
Copy link
Member

@Pil0tXia Pil0tXia left a comment

Choose a reason for hiding this comment

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

Please be noted that getClientGroupWrapper has some other usages in EventMesh~


ClientGroupWrapper cgw = this.getClientGroupMap().get(session.getClient().getGroup());
boolean flag = cgw != null && cgw.addGroupConsumerSession(session);
Copy link
Member

Choose a reason for hiding this comment

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

The key of clientGroupMap is subsystem, I'm not sure whether the group key here works well.

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.

Methods that continuously call WeakReference wrapper may throw an NPE
2 participants