Search in sources :

Example 1 with PersistenceContextInitializerImpl

use of org.infinispan.marshall.persistence.impl.PersistenceContextInitializerImpl in project infinispan by infinispan.

the class SerializationContextRegistryImpl method start.

@Start
public void start() {
    user.addContextInitializer(new CommonTypesSchema());
    user.addContextInitializer(new CommonContainerTypesSchema());
    user.addContextInitializer(new UserContextInitializerImpl());
    // Add user configured SCIs
    Collection<SerializationContextInitializer> initializers = globalConfig.serialization().contextInitializers();
    if (initializers == null || initializers.isEmpty()) {
        // If no SCIs have been explicitly configured, then load all available SCI services
        initializers = ServiceFinder.load(SerializationContextInitializer.class, globalConfig.classLoader());
    }
    initializers.forEach(user::addContextInitializer);
    String messageName = PersistenceContextInitializer.getFqTypeName(MarshallableUserObject.class);
    BaseMarshaller userObjectMarshaller = new MarshallableUserObject.Marshaller(messageName, userMarshaller.wired());
    update(GLOBAL, ctx -> ctx.addContextInitializer(new PersistenceContextInitializerImpl()).addContextInitializer(new org.infinispan.commons.GlobalContextInitializerImpl()).addMarshaller(userObjectMarshaller));
    update(PERSISTENCE, ctx -> ctx.addContextInitializer(new PersistenceContextInitializerImpl()).addMarshaller(userObjectMarshaller));
}
Also used : CommonTypesSchema(org.infinispan.protostream.types.java.CommonTypesSchema) BaseMarshaller(org.infinispan.protostream.BaseMarshaller) Marshaller(org.infinispan.commons.marshall.Marshaller) UserContextInitializerImpl(org.infinispan.commons.marshall.UserContextInitializerImpl) SerializationContextInitializer(org.infinispan.protostream.SerializationContextInitializer) CommonContainerTypesSchema(org.infinispan.protostream.types.java.CommonContainerTypesSchema) PersistenceContextInitializerImpl(org.infinispan.marshall.persistence.impl.PersistenceContextInitializerImpl) BaseMarshaller(org.infinispan.protostream.BaseMarshaller) Start(org.infinispan.factories.annotations.Start)

Aggregations

Marshaller (org.infinispan.commons.marshall.Marshaller)1 UserContextInitializerImpl (org.infinispan.commons.marshall.UserContextInitializerImpl)1 Start (org.infinispan.factories.annotations.Start)1 PersistenceContextInitializerImpl (org.infinispan.marshall.persistence.impl.PersistenceContextInitializerImpl)1 BaseMarshaller (org.infinispan.protostream.BaseMarshaller)1 SerializationContextInitializer (org.infinispan.protostream.SerializationContextInitializer)1 CommonContainerTypesSchema (org.infinispan.protostream.types.java.CommonContainerTypesSchema)1 CommonTypesSchema (org.infinispan.protostream.types.java.CommonTypesSchema)1