Class ClusterJavaSerializationMarshaller

java.lang.Object
org.infinispan.commons.marshall.AbstractMarshaller
org.infinispan.commons.marshall.JavaSerializationMarshaller
org.exoplatform.services.ispn.ClusterJavaSerializationMarshaller
All Implemented Interfaces:
org.infinispan.commons.marshall.Marshaller

public class ClusterJavaSerializationMarshaller extends org.infinispan.commons.marshall.JavaSerializationMarshaller
The marshaller of the cached keys and values: Java serialization, which accepts on read only the classes of the ClusterAllowList. It refuses as well to write a class off the list, so that a value the other nodes would refuse fails on the node that writes it, before anything is sent. Each class refused is logged once, as a warning. A write larger than the size WARN_SIZE_PROPERTY sets proceeds, and is logged once for what it writes, as a warning: a diagnosis of the values that load the cluster, not a limit.
  • Field Details

    • WARN_SIZE_PROPERTY

      public static final String WARN_SIZE_PROPERTY
      The size in bytes above which a write is logged; 0 or less turns the warning off
      See Also:
  • Constructor Details

    • ClusterJavaSerializationMarshaller

      public ClusterJavaSerializationMarshaller()
      A marshaller applying the list of this node.
  • Method Details

    • initialize

      public void initialize(org.infinispan.commons.configuration.ClassAllowList classAllowList)
      Keeps the platform's list only: an allow-list of an Infinispan configuration is refused when the configuration is loaded (Utils.configureSerialization(GlobalConfigurationBuilder, String)).
      Specified by:
      initialize in interface org.infinispan.commons.marshall.Marshaller
      Overrides:
      initialize in class org.infinispan.commons.marshall.JavaSerializationMarshaller
    • objectToBuffer

      protected org.infinispan.commons.io.ByteBuffer objectToBuffer(Object o, int estimatedSize) throws IOException
      Overrides:
      objectToBuffer in class org.infinispan.commons.marshall.JavaSerializationMarshaller
      Throws:
      IOException
    • objectToByteBuffer

      public byte[] objectToByteBuffer(Object o, UnaryOperator<Throwable> replacement) throws IOException
      Marshals a value whose throwables off the list are each replaced by the one the given function builds from it: a failure travels with the types of its chain the other nodes accept, a cause they would refuse described instead.
      Parameters:
      o - the value
      replacement - builds the throwable that stands for a throwable off the list, of a class on the list
      Returns:
      the marshalled value
      Throws:
      IOException - when the value holds a class off the list that is not a throwable
    • objectToByteBuffer

      public byte[] objectToByteBuffer(Object o, UnaryOperator<Throwable> replacement, Supplier<String> source) throws IOException
      Marshals a value as objectToByteBuffer(Object, UnaryOperator) does, naming it in the warning a write larger than the size of WARN_SIZE_PROPERTY logs.
      Parameters:
      o - the value
      replacement - builds the throwable that stands for a throwable off the list, or null to refuse it as any other class off the list
      source - names the value in the warning, a request of a command for example
      Returns:
      the marshalled value
      Throws:
      IOException - when the value holds a class off the list that is not replaced
    • objectFromByteBuffer

      public Object objectFromByteBuffer(byte[] buf, int offset, int length) throws IOException, ClassNotFoundException
      Specified by:
      objectFromByteBuffer in interface org.infinispan.commons.marshall.Marshaller
      Overrides:
      objectFromByteBuffer in class org.infinispan.commons.marshall.JavaSerializationMarshaller
      Throws:
      IOException
      ClassNotFoundException
    • warnIfOversized

      protected boolean warnIfOversized(int size, Supplier<String> source)
      Logs a write larger than the size of WARN_SIZE_PROPERTY the first time its source writes one: the write proceeds. Called after each write, which a subclass may observe.
      Parameters:
      size - the size of the write, in bytes
      source - names what is written
      Returns:
      true when the write was logged, false when it is within the size, the warning is off, or its source was already logged