Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-11614

PersistenceMarshaller should utilise an independent SerializationContext for user types

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 12.0.0.Final
    • 10.1.5.Final, 11.0.0.Dev03
    • Core
    • None

      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:

      1. 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.
      2. 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.
      3. DelegatingUserMarshaller. A wrapper class to call the start/stop of the configured user marshaller and log the marshaller being used.

              remerson@redhat.com Ryan Emerson
              remerson@redhat.com Ryan Emerson
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: