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 Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe size in bytes above which a write is logged; 0 or less turns the warning offFields inherited from class org.infinispan.commons.marshall.AbstractMarshaller
marshallableTypeHints -
Constructor Summary
ConstructorsConstructorDescriptionA marshaller applying the list of this node. -
Method Summary
Modifier and TypeMethodDescriptionvoidinitialize(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)).objectFromByteBuffer(byte[] buf, int offset, int length) protected org.infinispan.commons.io.ByteBufferobjectToBuffer(Object o, int estimatedSize) byte[]objectToByteBuffer(Object o, UnaryOperator<Throwable> replacement) 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.byte[]objectToByteBuffer(Object o, UnaryOperator<Throwable> replacement, Supplier<String> source) Marshals a value asobjectToByteBuffer(Object, UnaryOperator)does, naming it in the warning a write larger than the size ofWARN_SIZE_PROPERTYlogs.protected booleanwarnIfOversized(int size, Supplier<String> source) Logs a write larger than the size ofWARN_SIZE_PROPERTYthe first time its source writes one: the write proceeds.Methods inherited from class org.infinispan.commons.marshall.JavaSerializationMarshaller
isMarshallable, mediaTypeMethods inherited from class org.infinispan.commons.marshall.AbstractMarshaller
getBufferSizePredictor, objectFromByteBuffer, objectFromInputStream, objectToBuffer, objectToByteBuffer, objectToByteBuffer, objectToOutputStreamMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.infinispan.commons.marshall.Marshaller
start, stop
-
Field Details
-
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:
initializein interfaceorg.infinispan.commons.marshall.Marshaller- Overrides:
initializein classorg.infinispan.commons.marshall.JavaSerializationMarshaller
-
objectToBuffer
protected org.infinispan.commons.io.ByteBuffer objectToBuffer(Object o, int estimatedSize) throws IOException - Overrides:
objectToBufferin classorg.infinispan.commons.marshall.JavaSerializationMarshaller- Throws:
IOException
-
objectToByteBuffer
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 valuereplacement- 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 asobjectToByteBuffer(Object, UnaryOperator)does, naming it in the warning a write larger than the size ofWARN_SIZE_PROPERTYlogs.- Parameters:
o- the valuereplacement- builds the throwable that stands for a throwable off the list, ornullto refuse it as any other class off the listsource- 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:
objectFromByteBufferin interfaceorg.infinispan.commons.marshall.Marshaller- Overrides:
objectFromByteBufferin classorg.infinispan.commons.marshall.JavaSerializationMarshaller- Throws:
IOExceptionClassNotFoundException
-
warnIfOversized
Logs a write larger than the size ofWARN_SIZE_PROPERTYthe 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 bytessource- 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
-