File tree Expand file tree Collapse file tree 1 file changed +3
-11
lines changed
jsonb/src/main/java/io/avaje/jsonb/core Expand file tree Collapse file tree 1 file changed +3
-11
lines changed Original file line number Diff line number Diff line change 21
21
22
22
import java .lang .reflect .Type ;
23
23
import java .util .*;
24
+ import java .util .concurrent .ConcurrentHashMap ;
24
25
import java .util .concurrent .locks .ReentrantLock ;
25
26
26
27
/**
@@ -31,7 +32,7 @@ class CoreAdapterBuilder {
31
32
private final DJsonb context ;
32
33
private final List <JsonAdapter .Factory > factories ;
33
34
private final ThreadLocal <LookupChain > lookupChainThreadLocal = new ThreadLocal <>();
34
- private final Map <Object , JsonAdapter <?>> adapterCache = new LinkedHashMap <>();
35
+ private final Map <Object , JsonAdapter <?>> adapterCache = new ConcurrentHashMap <>();
35
36
private final ReentrantLock lock = new ReentrantLock ();
36
37
37
38
CoreAdapterBuilder (DJsonb context , List <JsonAdapter .Factory > userFactories , boolean mathAsString ) {
@@ -51,16 +52,7 @@ class CoreAdapterBuilder {
51
52
*/
52
53
@ SuppressWarnings ("unchecked" )
53
54
<T > JsonAdapter <T > get (Object cacheKey ) {
54
- lock .lock ();
55
- try {
56
- JsonAdapter <?> result = adapterCache .get (cacheKey );
57
- if (result != null ) {
58
- return (JsonAdapter <T >) result ;
59
- }
60
- } finally {
61
- lock .unlock ();
62
- }
63
- return null ;
55
+ return (JsonAdapter <T >) adapterCache .get (cacheKey );
64
56
}
65
57
66
58
/**
You can’t perform that action at this time.
0 commit comments