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.
| Modifier and Type | Field and Description |
|---|---|
| private final transient AtomicReference | _readOnlyMap
Most recent read-only instance, created from _sharedMap, if any. |
| private final LookupCache | _sharedMap
Shared, modifiable map; used if local read-only copy does not contain serializer caller expects. |
| public static final int | DEFAULT_MAX_CACHE_SIZE
By default, allow caching of up to 4000 serializer entries (for possibly up to 1000 types; but depending access patterns may be as few as half of that). |
| private static final long |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | |
| protected |
| Modifier and Type | Method and Description |
|---|---|
| private final synchronized ReadOnlyClassToSerializerMap | |
| public void | addAndResolveNonTypedSerializer(Class<?> type, ValueSerializer<Object> ser, SerializationContext provider)
|
| public void | addAndResolveNonTypedSerializer(JavaType type, ValueSerializer<Object> ser, SerializationContext provider)
|
| public void | addAndResolveNonTypedSerializer(Class<?> rawType, JavaType fullType, ValueSerializer<Object> ser, SerializationContext provider)
Another alternative that will cover both access via raw type and matching fully resolved type, in one fell swoop. |
| public void | addTypedSerializer(JavaType type, ValueSerializer<Object> ser)
Method called if none of lookups succeeded, and caller had to construct a serializer. |
| public void | |
| public synchronized void | flush()
Method called by StdSerializationContext#flushCachedSerializers() to clear all cached serializers |
| public ReadOnlyClassToSerializerMap | getReadOnlyLookupMap()
Method that can be called to get a read-only instance populated from the most recent version of the shared lookup Map. |
| protected Object | |
| public int | |
| public SerializerCache | snapshot()
Implements tools. Method to call to get an instance that may not be modified through any other object, including `this`. |
| public ValueSerializer | |
| public ValueSerializer | |
| public ValueSerializer | untypedValueSerializer(Class<?> type)
Method that checks if the shared (and hence, synchronized) lookup Map might have untyped serializer for given type. |
| public ValueSerializer |
| _readOnlyMap | back to summary |
|---|---|
| private final transient AtomicReference<ReadOnlyClassToSerializerMap> _readOnlyMap Most recent read-only instance, created from _sharedMap, if any. | |
| _sharedMap | back to summary |
|---|---|
| private final LookupCache<TypeKey, ValueSerializer<Object>> _sharedMap Shared, modifiable map; used if local read-only copy does not contain serializer caller expects. Note keys are of various types (see below for key types), in addition to
basic | |
| DEFAULT_MAX_CACHE_SIZE | back to summary |
|---|---|
| public static final int DEFAULT_MAX_CACHE_SIZE By default, allow caching of up to 4000 serializer entries (for possibly up to 1000 types; but depending access patterns may be as few as half of that). | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| SerializerCache | back to summary |
|---|---|
| public SerializerCache() | |
| SerializerCache | back to summary |
|---|---|
public SerializerCache(int maxCached)
| |
| SerializerCache | back to summary |
|---|---|
| public SerializerCache(LookupCache<TypeKey, ValueSerializer<Object>> cache) | |
| SerializerCache | back to summary |
|---|---|
| protected SerializerCache(SimpleLookupCache<TypeKey, ValueSerializer<Object>> shared) | |
| _makeReadOnlyLookupMap | back to summary |
|---|---|
| private final synchronized ReadOnlyClassToSerializerMap _makeReadOnlyLookupMap() | |
| addAndResolveNonTypedSerializer | back to summary |
|---|---|
| public void addAndResolveNonTypedSerializer(Class<?> type, ValueSerializer<Object> ser, SerializationContext provider) | |
| addAndResolveNonTypedSerializer | back to summary |
|---|---|
| public void addAndResolveNonTypedSerializer(JavaType type, ValueSerializer<Object> ser, SerializationContext provider) | |
| addAndResolveNonTypedSerializer | back to summary |
|---|---|
| public void addAndResolveNonTypedSerializer(Class<?> rawType, JavaType fullType, ValueSerializer<Object> ser, SerializationContext provider) Another alternative that will cover both access via raw type and matching fully resolved type, in one fell swoop. | |
| addTypedSerializer | back to summary |
|---|---|
| public void addTypedSerializer(JavaType type, ValueSerializer<Object> ser) Method called if none of lookups succeeded, and caller had to construct a serializer. If so, we will update the shared lookup map so that it can be resolved via it next time. | |
| addTypedSerializer | back to summary |
|---|---|
| public void addTypedSerializer(Class<?> cls, ValueSerializer<Object> ser) | |
| flush | back to summary |
|---|---|
| public synchronized void flush() Method called by StdSerializationContext#flushCachedSerializers() to clear all cached serializers | |
| getReadOnlyLookupMap | back to summary |
|---|---|
| public ReadOnlyClassToSerializerMap getReadOnlyLookupMap() Method that can be called to get a read-only instance populated from the most recent version of the shared lookup Map. | |
| readResolve | back to summary |
|---|---|
| protected Object readResolve() | |
| size | back to summary |
|---|---|
| public int size() | |
| snapshot | back to summary |
|---|---|
| public SerializerCache snapshot() Implements tools. Doc from tools. Method to call to get an instance that may not be modified through any other object, including `this`. That instance may be `this` if (and only if) this instance is effectively immutable (unmodifiable) through its API: if this is not the case, a new copy with same configuration must be created and returned.
| |
| typedValueSerializer | back to summary |
|---|---|
| public ValueSerializer | |
| typedValueSerializer | back to summary |
|---|---|
| public ValueSerializer | |
| untypedValueSerializer | back to summary |
|---|---|
| public ValueSerializer Method that checks if the shared (and hence, synchronized) lookup Map might have untyped serializer for given type. | |
| untypedValueSerializer | back to summary |
|---|---|
| public ValueSerializer | |