-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add a way to configure DeserializerCache
Jackson uses
#4101
Conversation
src/main/java/com/fasterxml/jackson/databind/deser/DeserializerCache.java
Outdated
Show resolved
Hide resolved
src/main/java/com/fasterxml/jackson/databind/deser/DeserializerCache.java
Outdated
Show resolved
Hide resolved
src/main/java/com/fasterxml/jackson/databind/deser/DeserializerCache.java
Outdated
Show resolved
Hide resolved
src/test/java/com/fasterxml/jackson/databind/cfg/CacheProviderTest.java
Outdated
Show resolved
Hide resolved
I like this @JooHyukKim , great start! Added some notes on details, nothing major. One other thing: somehow I thought I think this should work. Maybe we can get it in 2.16, although right now I am bit overloaded on reviews. |
Thank you for the review! 🙏🏼 Comments came in earlier than I thought :) and I will work on them later after work.
Right, no time pressure here 👍🏻 |
src/main/java/com/fasterxml/jackson/databind/DeserializationConfig.java
Outdated
Show resolved
Hide resolved
DeserializerCache
via CacheProvider
We can also split this PR into a few smaller ones :
... and of course a tracker-issue for tracking those PRs. |
src/main/java/com/fasterxml/jackson/databind/CacheProvider.java
Outdated
Show resolved
Hide resolved
src/main/java/com/fasterxml/jackson/databind/CacheProvider.java
Outdated
Show resolved
Hide resolved
src/main/java/com/fasterxml/jackson/databind/DefaultCacheProvider.java
Outdated
Show resolved
Hide resolved
src/main/java/com/fasterxml/jackson/databind/DefaultCacheProvider.java
Outdated
Show resolved
Hide resolved
src/main/java/com/fasterxml/jackson/databind/DeserializationConfig.java
Outdated
Show resolved
Hide resolved
src/main/java/com/fasterxml/jackson/databind/DeserializationContext.java
Outdated
Show resolved
Hide resolved
src/main/java/com/fasterxml/jackson/databind/deser/DeserializerCache.java
Outdated
Show resolved
Hide resolved
src/test/java/com/fasterxml/jackson/databind/cfg/CacheProviderTest.java
Outdated
Show resolved
Hide resolved
.cacheProvider(new CustomCacheProvider()) | ||
.build(); | ||
|
||
assertTrue(invoked); |
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.
I think it'd be better to make CustomCacheProvider
itself stateful, possibly returning a shared instance of test SimpleTestCache
and storing state in there -- relying on static
in test class is bit tightly coupled.
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.
Agreed. Will do👍🏻
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.
done!
|
||
@Override | ||
public JsonDeserializer<Object> putIfAbsent(JavaType key, JsonDeserializer<Object> value) { | ||
invoked = true; |
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.
Is it intended that all calls set invoked
to true?
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.
yes, Just to check that the instance is actually used. Let me change named to invokedAtLeastOnce
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.
done also
src/main/java/com/fasterxml/jackson/databind/DeserializationContext.java
Show resolved
Hide resolved
@JooHyukKim Finally the first, trickiest part done -- will try to get merged into |
True, true. That's what we all want 😆 @cowtowncoder Thank you for the final(and finer) touches 👍🏻 . Later today, I will try to link commits and PRs back to #2502 in more structured way, as list of done’s and TODO’s. |
@JooHyukKim Thank you again for contributing this & tweaking things. I was able to merge it successfully into |
part of #2502