java.lang.Object
com.broadleafcommerce.common.extension.serialization.FurySerializer
All Implemented Interfaces:
Serializer, org.springframework.beans.factory.InitializingBean

public class FurySerializer extends Object implements org.springframework.beans.factory.InitializingBean, Serializer
A thread-safe and optimized implementation of the 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 Details

  • Method Details

    • getInstance

      public static FurySerializer getInstance()
    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception
    • serialize

      public byte[] serialize(Object object)
      Description copied from interface: Serializer
      Serializes 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:
      serialize in interface Serializer
      Parameters:
      object - the object to be serialized; must not be null
      Returns:
      a byte array representing the serialized form of the object
    • read

      public Object read(byte[] binary)
      Description copied from interface: Serializer
      Deserializes 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:
      read in interface Serializer
      Parameters:
      binary - the byte array representing the serialized object; must not be null
      Returns:
      the deserialized object reconstructed from the binary data