FasterXML / java-classmate

Library for introspecting generic type information of types, member/static methods, fields. Especially useful for POJO/Bean introspection.
http://fasterxml.com
Apache License 2.0
258 stars 42 forks source link

Make cache used by `TypeResolver` pluggable; offer concurrent variant in addition to LRU #41

Closed cowtowncoder closed 6 years ago

cowtowncoder commented 6 years ago

Currently TypeResolver uses simple LRU-cache, built on LinkedHashMap. While that works fine for many use cases there may be cases where highly concurrent, high call rate may lead to concurrency issues (see #40). Since caching should be easy to make pluggable, let's allow passing of alternate cache implementations for TypeResolver.

In addition to extracting current LRU-based implementation as LRUTypeCache (implementing ResolvedTypeCache which becomes abstract base class), let's also implement simple ConcurrentHashMap-based alternative, ConcurrentTypeCache.