HHH-10306 Plug Externalizers via module initializer

This commit is contained in:
Galder Zamarreño 2015-11-26 16:54:54 +01:00 committed by Radim Vansa
parent 603059b640
commit c4d5e3b950
4 changed files with 26 additions and 12 deletions

View File

@ -493,7 +493,6 @@ public class InfinispanRegionFactory implements RegionFactory {
.globalJmxStatistics()
.enabled( Boolean.parseBoolean( globalStats ) );
}
holder.getGlobalConfigurationBuilder().serialization().addAdvancedExternalizer(Externalizers.ALL_EXTERNALIZERS);
return createCacheManager( holder );
}

View File

@ -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<UUID> {
@Override

View File

@ -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<Integer, AdvancedExternalizer<?>> 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() );
}
}

View File

@ -0,0 +1 @@
org.hibernate.cache.infinispan.util.LifecycleCallbacks