Search code examples
javaserializationinfinispaninfinispan-10

Can I configure Infinispan to use JavaSerializationMarshaller() on a specific cache and use protobufs on other caches?


I am attempting to upgrade from Infinispan 8.2.11.Final to Infinispan 10.1.8.Final. Infinispan now uses protocol buffers by default. The Infinispan cache is used by Hibernate and also contains some application objects.

I can set the global marshaller as follows:

    holder.getGlobalConfigurationBuilder()
          .serialization()
          .marshaller( new JavaSerializationMarshaller() )
          .whiteList().addClasses( CLASSES );

However, if I do this it will be necessary to whitelist all the hibernate classes (e.g. org.hibernate.cache.internal.CacheKeyImplementation and others).

Is it possible to set the marshaller on the caches used for application objects so that I can continue to use Java serialization for my application objects while allowing Hibernate to use protobuf?


Solution

  • No. The marshaller is global to all caches.

    You can add the Hibernate package to the white list by doing:

    .whiteList().addRegexps("org\\.hibernate.*");
    

    Check for more info in Infinispan docs here and here.

    offtopic: the last stable release is 11.0.1.Final.