Package com.fasterxml.classmate.util
Class ConcurrentTypeCache
- java.lang.Object
-
- com.fasterxml.classmate.util.ResolvedTypeCache
-
- com.fasterxml.classmate.util.ConcurrentTypeCache
-
- All Implemented Interfaces:
java.io.Serializable
public class ConcurrentTypeCache extends ResolvedTypeCache
AlternativeResolvedTypeCache
implementation that usesConcurrentHashMap
for efficient concurrent access and limits maximum entry count to specified maximum. But instead of trying to optimize retention by access (asLRUTypeCache
does, will simply clear (remove all entries) if maximum size is reached. This works well as long as maximum size is large enough to cover most commonly resolved types, and works well for higher concurrency use cases.- See Also:
LRUTypeCache
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.concurrent.ConcurrentHashMap<ResolvedTypeKey,ResolvedType>
_map
protected int
_maxEntries
private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description ConcurrentTypeCache(int maxEntries)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ResolvedType
find(ResolvedTypeKey key)
void
put(ResolvedTypeKey key, ResolvedType type)
(package private) java.lang.Object
readResolve()
int
size()
-
Methods inherited from class com.fasterxml.classmate.util.ResolvedTypeCache
_addForTest, concurrentCache, key, key, lruCache
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
_maxEntries
protected final int _maxEntries
-
_map
protected final transient java.util.concurrent.ConcurrentHashMap<ResolvedTypeKey,ResolvedType> _map
-
-
Method Detail
-
readResolve
java.lang.Object readResolve()
-
find
public ResolvedType find(ResolvedTypeKey key)
- Specified by:
find
in classResolvedTypeCache
-
size
public int size()
- Specified by:
size
in classResolvedTypeCache
-
put
public void put(ResolvedTypeKey key, ResolvedType type)
- Specified by:
put
in classResolvedTypeCache
-
-