Class FurySerializer
- All Implemented Interfaces:
Serializer,org.springframework.beans.factory.InitializingBean
Serializer interface, utilizing the
Fury serialization library for efficient serialization and deserialization of objects in Java.
Provides a singleton instance for global accessibility.
The serializer is configured upon initialization with a custom allow-list mechanism to enforce security checks for class deserialization.
This class provides pool-based thread-safe serialization and deserialization using the underlying `ThreadSafeFury` implementation.
Initialization: During initialization, the Fury Serializer is configured using properties defined
in SerializationProperties.Convert. These properties include the allow list of classes,
pool size limits, and expiration time for pooled objects.
Thread Safety: The class utilizes `ThreadSafeFury` for ensuring thread-safety during serialization and deserialization processes. This is achieved by maintaining a thread pool with customizable configurations for concurrency.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidstatic FurySerializerread(byte[] binary) Deserializes the given binary data into an object.byte[]Serializes the given object into a binary format represented as a byte array.
-
Constructor Details
-
FurySerializer
-
-
Method Details
-
getInstance
-
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-
serialize
Description copied from interface:SerializerSerializes the given object into a binary format represented as a byte array. This allows objects to be persisted, cached, or transferred across systems.- Specified by:
serializein interfaceSerializer- Parameters:
object- the object to be serialized; must not be null- Returns:
- a byte array representing the serialized form of the object
-
read
Description copied from interface:SerializerDeserializes the given binary data into an object. This method uses the provided byte array to reconstruct an object instance, typically reversing the process performed during serialization.- Specified by:
readin interfaceSerializer- Parameters:
binary- the byte array representing the serialized object; must not be null- Returns:
- the deserialized object reconstructed from the binary data
-