Class SerializationLimitPolicy

java.lang.Object
com.tangosol.io.SerializationLimitPolicy

public class SerializationLimitPolicy extends Object
Generic serializer-owned limits for serialized container structures.
Since:
26.04
Author:
Aleks Seovic 2026.05.20
  • Field Details

    • PROP_MAX_CONTAINER_BYTES

      public static final String PROP_MAX_CONTAINER_BYTES
      Maximum serialized container bytes property.
      See Also:
    • PROP_MAX_ELEMENTS

      public static final String PROP_MAX_ELEMENTS
      Maximum array/collection/object element count property.
      See Also:
    • PROP_MAX_MAP_ENTRIES

      public static final String PROP_MAX_MAP_ENTRIES
      Maximum map-entry count property.
      See Also:
    • XML_LIMITS

      public static final String XML_LIMITS
      Serializer limits element.
      See Also:
    • XML_MAX_CONTAINER_BYTES

      public static final String XML_MAX_CONTAINER_BYTES
      Maximum serialized container bytes element.
      See Also:
    • XML_MAX_ELEMENTS

      public static final String XML_MAX_ELEMENTS
      Maximum array/collection/object element count element.
      See Also:
    • XML_MAX_MAP_ENTRIES

      public static final String XML_MAX_MAP_ENTRIES
      Maximum map-entry count element.
      See Also:
    • DEFAULT_MAX_CONTAINER_BYTES

      public static final long DEFAULT_MAX_CONTAINER_BYTES
      Initial hardened serialized container byte cap.
      See Also:
    • DEFAULT_MAX_ELEMENTS

      public static final int DEFAULT_MAX_ELEMENTS
      Initial hardened array/collection/object element cap.
      See Also:
    • DEFAULT_MAX_MAP_ENTRIES

      public static final int DEFAULT_MAX_MAP_ENTRIES
      Initial hardened map-entry cap.
      See Also:
  • Constructor Details

    • SerializationLimitPolicy

      public SerializationLimitPolicy(Long cbMaxContainer, Integer cMaxElements, Integer cMaxMapEntries)
      Create a policy.
      Parameters:
      cbMaxContainer - maximum container bytes, or null
      cMaxElements - maximum elements, or null
      cMaxMapEntries - maximum map entries, or null
  • Method Details

    • getMaxContainerBytes

      public Long getMaxContainerBytes()
      Return the maximum serialized container byte count, or null for unlimited.
      Returns:
      the maximum serialized container byte count
    • getMaxElements

      public Integer getMaxElements()
      Return the maximum array, collection, or object-array element count, or null for unlimited.
      Returns:
      the maximum element count
    • getMaxMapEntries

      public Integer getMaxMapEntries()
      Return the maximum map-entry count, or null for unlimited.
      Returns:
      the maximum map-entry count
    • validateContainerBytes

      public void validateContainerBytes(String sKind, int cb) throws IOException
      Validate a byte count.
      Parameters:
      sKind - the structure kind
      cb - the byte count
      Throws:
      IOException - if the count is invalid or exceeds the policy
    • validateElements

      public void validateElements(String sKind, int c) throws IOException
      Validate an element count.
      Parameters:
      sKind - the structure kind
      c - the element count
      Throws:
      IOException - if the count is invalid or exceeds the policy
    • validateMapEntries

      public void validateMapEntries(String sKind, int c) throws IOException
      Validate a map-entry count.
      Parameters:
      sKind - the structure kind
      c - the entry count
      Throws:
      IOException - if the count is invalid or exceeds the policy
    • merge

      Merge this policy with the supplied override. Any null values in the override inherit from this policy.
      Parameters:
      override - the override policy, or null
      Returns:
      the merged policy
    • getDefault

      public static SerializationLimitPolicy getDefault()
      Return the global default policy.
      Returns:
      the global default policy
    • fromXml

      public static SerializationLimitPolicy fromXml(XmlElement xmlLimits)
      Parse a <limits> element as an override policy.
      Parameters:
      xmlLimits - the limits element, or null
      Returns:
      the parsed policy, or null
    • apply

      public static Serializer apply(Serializer serializer, SerializationLimitPolicy policy)
      Apply a policy to a serializer if it supports limit injection.
      Parameters:
      serializer - the serializer
      policy - the policy, or null
      Returns:
      the serializer