diff --git a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/InfinispanRegionFactory.java b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/InfinispanRegionFactory.java index f401238d6f..ce732c4ed3 100644 --- a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/InfinispanRegionFactory.java +++ b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/InfinispanRegionFactory.java @@ -493,7 +493,6 @@ public class InfinispanRegionFactory implements RegionFactory { .globalJmxStatistics() .enabled( Boolean.parseBoolean( globalStats ) ); } - holder.getGlobalConfigurationBuilder().serialization().addAdvancedExternalizer(Externalizers.ALL_EXTERNALIZERS); return createCacheManager( holder ); } diff --git a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/Externalizers.java b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/Externalizers.java index 021e121840..2202e31e2b 100644 --- a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/Externalizers.java +++ b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/Externalizers.java @@ -29,17 +29,6 @@ public class Externalizers { public final static int VERSIONED_ENTRY = 1206; public final static int EXCLUDE_EMPTY_EXTRACT_VALUE = 1207; - public final static AdvancedExternalizer[] ALL_EXTERNALIZERS = new AdvancedExternalizer[] { - new UUIDExternalizer(), - new Tombstone.Externalizer(), - new Tombstone.ExcludeTombstonesFilterExternalizer(), - new TombstoneUpdate.Externalizer(), - new FutureUpdate.Externalizer(), - new FutureUpdate.ValueExtractorExternalizer(), - new VersionedEntry.Externalizer(), - new VersionedEntry.ExcludeEmptyExtractValueExternalizer() - }; - public static class UUIDExternalizer implements AdvancedExternalizer { @Override diff --git a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/LifecycleCallbacks.java b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/LifecycleCallbacks.java new file mode 100644 index 0000000000..b2b6a5f1a8 --- /dev/null +++ b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/LifecycleCallbacks.java @@ -0,0 +1,25 @@ +package org.hibernate.cache.infinispan.util; + +import org.infinispan.commons.marshall.AdvancedExternalizer; +import org.infinispan.configuration.global.GlobalConfiguration; +import org.infinispan.factories.GlobalComponentRegistry; +import org.infinispan.lifecycle.AbstractModuleLifecycle; + +import java.util.Map; + +public class LifecycleCallbacks extends AbstractModuleLifecycle { + + @Override + public void cacheManagerStarting(GlobalComponentRegistry gcr, GlobalConfiguration globalCfg) { + Map> externalizerMap = globalCfg.serialization().advancedExternalizers(); + externalizerMap.put( Externalizers.UUID, new Externalizers.UUIDExternalizer() ); + externalizerMap.put( Externalizers.TOMBSTONE, new Tombstone.Externalizer() ); + externalizerMap.put( Externalizers.EXCLUDE_TOMBSTONES_FILTER, new Tombstone.ExcludeTombstonesFilterExternalizer() ); + externalizerMap.put( Externalizers.TOMBSTONE_UPDATE, new TombstoneUpdate.Externalizer() ); + externalizerMap.put( Externalizers.FUTURE_UPDATE, new FutureUpdate.Externalizer() ); + externalizerMap.put( Externalizers.VALUE_EXTRACTOR, new FutureUpdate.ValueExtractorExternalizer() ); + externalizerMap.put( Externalizers.VERSIONED_ENTRY, new VersionedEntry.Externalizer() ); + externalizerMap.put( Externalizers.EXCLUDE_EMPTY_EXTRACT_VALUE, new VersionedEntry.ExcludeEmptyExtractValueExternalizer() ); + } + +} diff --git a/hibernate-infinispan/src/main/resources/META-INF/services/org.infinispan.lifecycle.ModuleLifecycle b/hibernate-infinispan/src/main/resources/META-INF/services/org.infinispan.lifecycle.ModuleLifecycle new file mode 100644 index 0000000000..902a405bd7 --- /dev/null +++ b/hibernate-infinispan/src/main/resources/META-INF/services/org.infinispan.lifecycle.ModuleLifecycle @@ -0,0 +1 @@ +org.hibernate.cache.infinispan.util.LifecycleCallbacks