use of org.infinispan.counter.impl.persistence.PersistenceContextInitializerImpl in project infinispan by infinispan.
the class CounterModuleLifecycle method cacheManagerStarting.
@Override
public void cacheManagerStarting(GlobalComponentRegistry gcr, GlobalConfiguration globalConfiguration) {
final Map<Integer, AdvancedExternalizer<?>> externalizerMap = globalConfiguration.serialization().advancedExternalizers();
// Only required by GlobalMarshaller
addAdvancedExternalizer(externalizerMap, ResetFunction.EXTERNALIZER);
addAdvancedExternalizer(externalizerMap, ReadFunction.EXTERNALIZER);
addAdvancedExternalizer(externalizerMap, InitializeCounterFunction.EXTERNALIZER);
addAdvancedExternalizer(externalizerMap, AddFunction.EXTERNALIZER);
addAdvancedExternalizer(externalizerMap, CompareAndSwapFunction.EXTERNALIZER);
addAdvancedExternalizer(externalizerMap, CreateAndCASFunction.EXTERNALIZER);
addAdvancedExternalizer(externalizerMap, CreateAndAddFunction.EXTERNALIZER);
addAdvancedExternalizer(externalizerMap, RemoveFunction.EXTERNALIZER);
BasicComponentRegistry bcr = gcr.getComponent(BasicComponentRegistry.class);
EmbeddedCacheManager cacheManager = bcr.getComponent(EmbeddedCacheManager.class).wired();
InternalCacheRegistry internalCacheRegistry = bcr.getComponent(InternalCacheRegistry.class).running();
SerializationContextRegistry ctxRegistry = gcr.getComponent(SerializationContextRegistry.class);
ctxRegistry.addContextInitializer(SerializationContextRegistry.MarshallerType.PERSISTENCE, new PersistenceContextInitializerImpl());
CounterManagerConfiguration counterManagerConfiguration = extractConfiguration(globalConfiguration);
if (gcr.getGlobalConfiguration().isClustered()) {
// only attempts to create the caches if the cache manager is clustered.
registerCounterCache(internalCacheRegistry, counterManagerConfiguration);
} else {
// local only cache manager.
registerLocalCounterCache(internalCacheRegistry);
}
registerCounterNotificationManager(bcr);
registerCounterManager(cacheManager, bcr, globalConfiguration);
}
Aggregations