Class SerializerCache


  • public final class SerializerCache
    extends Object
    Simple cache object that allows for doing 2-level lookups: first level is by "local" read-only lookup Map (used without locking) and second backup level is by a shared modifiable HashMap. The idea is that after a while, most serializers are found from the local Map (to optimize performance, reduce lock contention), but that during buildup we can use a shared map to reduce both number of distinct read-only maps constructed, and number of serializers constructed.

    Cache contains three kinds of entries, based on combination of class pair key. First class in key is for the type to serialize, and second one is type used for determining how to resolve value type. One (but not both) of entries can be null.