PersistenceMarshaller should utilise an independent
SerializationContext for user types
---------------------------------------------------------------------------------------
Key: ISPN-11614
URL:
https://issues.redhat.com/browse/ISPN-11614
Project: Infinispan
Issue Type: Bug
Components: Core
Affects Versions: 10.1.5.Final, 11.0.0.Dev03
Reporter: Ryan Emerson
Assignee: Ryan Emerson
Priority: Major
Fix For: 12.0.0.CR1
If a user configures a SerializationContextInitializer it is currently registered to the
same SerializationContext as the persistent internal types. This means that it is possible
for a user to reference internal protobuf message types in their .proto files.
We should introduce the following:
# A "user" SerializationContext that is used exclusively for user types
configured via xml/service-loader/programmatically:
User types are only registered with this context. The global and persistence contexts do
not register these types. If a type does not exist in the global/persistence context,
then it's wrapped with a MarshallableUserObject and marshalling is delegated to the
user marshaller. Previously this only occurred if a custom marshaller was defined as user
types were added to the global/persistence context, but as this is no longer the case all
user types are wrapped.
# A USER_MARSHALLER created by MarshallerFactory, which if a custom marshaller is not
defined creates a ProtoStream based marshaller that consumes the user
SerializationContext, if a custom marshaller is defined then that is returned:
This logic was previously in the PersistenceMarshallerImpl, but this allows us to inject
the marshaller directly into various places in the code.
# DelegatingUserMarshaller. A wrapper class to call the start/stop of the configured
user marshaller and log the marshaller being used.