Package org.apache.pekko.serialization
Class NestedDeserialization$
java.lang.Object
org.apache.pekko.serialization.NestedDeserialization$
INTERNAL API
Bounds how deeply one deserialization may nest.
Several wire formats carry a nested payload: the enclosed message is an opaque byte
array that is deserialized in turn, and that payload may itself enclose another. Each
level is parsed on its own, so a protobuf parser's nesting limit does not bound the
chain - only the size of the message does. Recursion therefore tracks the nesting
rather than the size of the message, and a sufficiently deep chain fails with a
StackOverflowError instead of a serialization error.
The depth is per thread because one message is deserialized synchronously on one thread.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final NestedDeserialization$Static reference to the singleton instance of this Scala object. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> TatNextLevel(int max, scala.Function0<T> body) Runsbodyone level deeper, failing withNotSerializableException- the ordinary way a message that cannot be deserialized is reported - when the nesting exceedsmax.intCurrent nesting depth, for testing.
-
Field Details
-
MODULE$
Static reference to the singleton instance of this Scala object.
-
-
Constructor Details
-
NestedDeserialization$
public NestedDeserialization$()
-
-
Method Details
-
atNextLevel
public <T> T atNextLevel(int max, scala.Function0<T> body) Runsbodyone level deeper, failing withNotSerializableException- the ordinary way a message that cannot be deserialized is reported - when the nesting exceedsmax. -
currentDepth
public int currentDepth()Current nesting depth, for testing.
-