Search in sources :

Example 1 with PersistenceContextInitializerImpl

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);
}
Also used : BasicComponentRegistry(org.infinispan.factories.impl.BasicComponentRegistry) SerializationContextRegistry(org.infinispan.marshall.protostream.impl.SerializationContextRegistry) PersistenceContextInitializerImpl(org.infinispan.counter.impl.persistence.PersistenceContextInitializerImpl) InternalCacheRegistry(org.infinispan.registry.InternalCacheRegistry) AdvancedExternalizer(org.infinispan.commons.marshall.AdvancedExternalizer) EmbeddedCacheManager(org.infinispan.manager.EmbeddedCacheManager) CounterManagerConfiguration(org.infinispan.counter.configuration.CounterManagerConfiguration)

Aggregations

AdvancedExternalizer (org.infinispan.commons.marshall.AdvancedExternalizer)1 CounterManagerConfiguration (org.infinispan.counter.configuration.CounterManagerConfiguration)1 PersistenceContextInitializerImpl (org.infinispan.counter.impl.persistence.PersistenceContextInitializerImpl)1 BasicComponentRegistry (org.infinispan.factories.impl.BasicComponentRegistry)1 EmbeddedCacheManager (org.infinispan.manager.EmbeddedCacheManager)1 SerializationContextRegistry (org.infinispan.marshall.protostream.impl.SerializationContextRegistry)1 InternalCacheRegistry (org.infinispan.registry.InternalCacheRegistry)1