Interface SerializationProvider
-
- All Superinterfaces:
Service
public interface SerializationProvider extends Service
AServiceprovidingSerializerinstances.The
CacheManagerobtainsan instance of thisServiceprior to creating anyCacheinstances. Before creating eachCacheinstance, theCacheManagercalls thecreateKeySerializer(Class, ClassLoader, ServiceConfiguration[])andcreateValueSerializer(Class, ClassLoader, ServiceConfiguration[])methods to obtainSerializerinstances for theCache, either through explicit configuration or fromCacheManagerlevel configuration.Some
Cacheconfigurations make serialization mandatory. If serialization is mandatory, failure to return aSerializerfrom aSerializationProviderresults in aCacheinitialization failure. For aCachein which serialization is not mandatory, failing to return aSerializerwill not causeCacheinitialization failure.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> Serializer<T>createKeySerializer(java.lang.Class<T> clazz, java.lang.ClassLoader classLoader, ServiceConfiguration<?,?>... configs)Creates a keySerializerwith the given parameters.<T> Serializer<T>createValueSerializer(java.lang.Class<T> clazz, java.lang.ClassLoader classLoader, ServiceConfiguration<?,?>... configs)Creates a valueSerializerwith the given parameters.voidreleaseSerializer(Serializer<?> serializer)Releases the givenSerializerinstance.
-
-
-
Method Detail
-
createKeySerializer
<T> Serializer<T> createKeySerializer(java.lang.Class<T> clazz, java.lang.ClassLoader classLoader, ServiceConfiguration<?,?>... configs) throws UnsupportedTypeException
Creates a keySerializerwith the given parameters.- Type Parameters:
T- the type serialized to serialize to/from- Parameters:
clazz- the class of the type to serialize to/fromclassLoader- the classloader used to load classes during deserialization; may benullconfigs- theServiceConfigurationinstances available through theCacheManager- Returns:
- a
Serializerinstance, possiblynull - Throws:
UnsupportedTypeException- if a serializer cannot be created for the given type
-
createValueSerializer
<T> Serializer<T> createValueSerializer(java.lang.Class<T> clazz, java.lang.ClassLoader classLoader, ServiceConfiguration<?,?>... configs) throws UnsupportedTypeException
Creates a valueSerializerwith the given parameters.- Type Parameters:
T- the type serialized to serialize to/from- Parameters:
clazz- the class of the type to serialize to/fromclassLoader- the classloader used to load classes during deserialization; may benullconfigs- theServiceConfigurationinstances available through theCacheManager- Returns:
- a
Serializerinstance, possiblynull - Throws:
UnsupportedTypeException- if a serializer cannot be created for the given type
-
releaseSerializer
void releaseSerializer(Serializer<?> serializer) throws java.lang.Exception
Releases the givenSerializerinstance. If the serializer is obtained from aSerializationProviderand implementsCloseable, theclosemethod is invoked.- Parameters:
serializer- the serializer to be released- Throws:
java.lang.Exception- when the release fails
-
-