Skip to content

Possibility to add default reference type in inner use of ConcurrentReferenceHashMap (ResolvableType) #25028

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
fsgonz opened this issue May 7, 2020 · 4 comments
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: duplicate A duplicate of another issue

Comments

@fsgonz
Copy link
Contributor

fsgonz commented May 7, 2020

In the context of our framework, we come across a metaspace issue due to the use of soft references in ConcurrentReferenceHashMap by default.
That default can be set in the constructor but there are are some inner uses of that class relies on the default soft reference type.
For example:
ResolvableType

Can a change be performed to provide a way to set the reference types in this cases this without using reflection? Passing the reference type to ResolvableType for example.
Thanks!

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label May 7, 2020
@fsgonz fsgonz changed the title Possibility to add default reference type in inner use of ConcurrentReferenceHashMap Possibility to add default reference type in inner use of ConcurrentReferenceHashMap (ResolvableType) May 7, 2020
@jhoeller
Copy link
Contributor

jhoeller commented May 7, 2020

The problem with the reference types is that ´weak´ does not necessarily make sense in such places since the key is not held on to, like in ResolvableType. Switching this to weak references might be almost equivalent to having no cache at all...

If your problem is with specific internal caches there, could you elaborate on the specifics that you're seeing? Could you maybe call ResolvableType.clearCache() at certain points? Is there anything else we could offer as a remedy for your scenario?

@jhoeller jhoeller self-assigned this May 7, 2020
@rstoyanchev rstoyanchev added the in: core Issues in core modules (aop, beans, core, context, expression) label Nov 10, 2021
@eze210
Copy link

eze210 commented Jun 26, 2023

Hello, is it possible to make the field DEFAULT_REFERENCE_TYPE configurable? I understand that changing the default could lead to unexpected behaviors, so I don't suggest changing the default, but just making the field configurable with a setter or making it public.

Apart of the ResolvableType cache, there are several caches in the framework, and some of them can't be cleared by using the API methods. For example, the one present in BridgeMethodResolver

Thanks!

@bclozel
Copy link
Member

bclozel commented Nov 27, 2023

Closing as a duplicate of #23284 (comment)

@bclozel bclozel closed this as not planned Won't fix, can't repro, duplicate, stale Nov 27, 2023
@bclozel bclozel added status: duplicate A duplicate of another issue and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Nov 27, 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) status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

6 participants