Search in sources :

Example 16 with InternalCacheRegistry

use of org.infinispan.registry.InternalCacheRegistry in project infinispan by infinispan.

the class CheckAddressTask method defineTopologyCacheConfig.

private void defineTopologyCacheConfig(EmbeddedCacheManager cacheManager) {
    InternalCacheRegistry internalCacheRegistry = SecurityActions.getGlobalComponentRegistry(cacheManager).getComponent(InternalCacheRegistry.class);
    internalCacheRegistry.registerInternalCache(configuration.topologyCacheName(), createTopologyCacheConfig(cacheManager.getCacheManagerConfiguration().transport().distributedSyncTimeout()).build(), EnumSet.of(InternalCacheRegistry.Flag.EXCLUSIVE));
}
Also used : InternalCacheRegistry(org.infinispan.registry.InternalCacheRegistry)

Example 17 with InternalCacheRegistry

use of org.infinispan.registry.InternalCacheRegistry in project infinispan by infinispan.

the class LifecycleCallbacks method registerGlobalTxTable.

/**
 * Creates the global transaction internal cache.
 */
private void registerGlobalTxTable() {
    InternalCacheRegistry registry = globalComponentRegistry.getComponent(InternalCacheRegistry.class);
    ConfigurationBuilder builder = new ConfigurationBuilder();
    // we can't lose transactions. distributed cache can lose data is num_owner nodes crash at the same time
    // If this cache is changed from REPL/LOCAL it will also become blocking - and the blockhound exception in
    // ServerHotrodBlockHoundIntegration will no longer be correct
    builder.clustering().cacheMode(globalCfg.isClustered() ? CacheMode.REPL_SYNC : CacheMode.LOCAL);
    builder.transaction().transactionMode(TransactionMode.NON_TRANSACTIONAL);
    // persistent? should we keep the transaction after restart?
    registry.registerInternalCache(GLOBAL_TX_TABLE_CACHE_NAME, builder.build(), EnumSet.noneOf(InternalCacheRegistry.Flag.class));
}
Also used : ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) InternalCacheRegistry(org.infinispan.registry.InternalCacheRegistry)

Example 18 with InternalCacheRegistry

use of org.infinispan.registry.InternalCacheRegistry in project infinispan by infinispan.

the class LifecycleCallbacks method cacheManagerStarting.

@Override
public void cacheManagerStarting(GlobalComponentRegistry gcr, GlobalConfiguration gc) {
    SerializationContextRegistry ctxRegistry = gcr.getComponent(SerializationContextRegistry.class);
    ctxRegistry.addContextInitializer(MarshallerType.PERSISTENCE, new org.infinispan.server.logging.events.PersistenceContextInitializerImpl());
    ctxRegistry.addContextInitializer(MarshallerType.PERSISTENCE, new org.infinispan.server.state.PersistenceContextInitializerImpl());
    EmbeddedCacheManager cacheManager = gcr.getComponent(EmbeddedCacheManager.class);
    InternalCacheRegistry internalCacheRegistry = gcr.getComponent(InternalCacheRegistry.class);
    internalCacheRegistry.registerInternalCache(ServerEventLogger.EVENT_LOG_CACHE, getTaskHistoryCacheConfiguration(cacheManager).build(), EnumSet.of(InternalCacheRegistry.Flag.PERSISTENT, InternalCacheRegistry.Flag.QUERYABLE));
    // Install the new logger component
    oldEventLogger = gcr.getComponent(EventLogManager.class).replaceEventLogger(new ServerEventLogger(cacheManager, gcr.getTimeService()));
}
Also used : SerializationContextRegistry(org.infinispan.marshall.protostream.impl.SerializationContextRegistry) InternalCacheRegistry(org.infinispan.registry.InternalCacheRegistry) ServerEventLogger(org.infinispan.server.logging.events.ServerEventLogger) EmbeddedCacheManager(org.infinispan.manager.EmbeddedCacheManager)

Example 19 with InternalCacheRegistry

use of org.infinispan.registry.InternalCacheRegistry in project infinispan by infinispan.

the class LifecycleManager method cacheStarting.

@Override
public void cacheStarting(ComponentRegistry cr, Configuration cfg, String cacheName) {
    InternalCacheRegistry icr = cr.getGlobalComponentRegistry().getComponent(InternalCacheRegistry.class);
    if (!icr.isInternalCache(cacheName) || icr.internalCacheHasFlag(cacheName, Flag.QUERYABLE)) {
        cr.registerComponent(new IndexStatisticsSnapshotImpl(), IndexStatistics.class);
        cr.registerComponent(new LocalQueryStatistics(), LocalQueryStatistics.class);
        cr.registerComponent(new SearchStatsRetriever(), SearchStatsRetriever.class);
        AdvancedCache<?, ?> cache = cr.getComponent(Cache.class).getAdvancedCache();
        ClassLoader aggregatedClassLoader = makeAggregatedClassLoader(cr.getGlobalComponentRegistry().getGlobalConfiguration().classLoader());
        cr.registerComponent(new ReflectionMatcher(aggregatedClassLoader), ReflectionMatcher.class);
        cr.registerComponent(new QueryEngine<>(cache), QueryEngine.class);
    }
}
Also used : IndexStatisticsSnapshotImpl(org.infinispan.query.core.stats.impl.IndexStatisticsSnapshotImpl) AggregatedClassLoader(org.infinispan.commons.util.AggregatedClassLoader) InternalCacheRegistry(org.infinispan.registry.InternalCacheRegistry) LocalQueryStatistics(org.infinispan.query.core.stats.impl.LocalQueryStatistics) ReflectionMatcher(org.infinispan.objectfilter.impl.ReflectionMatcher) SearchStatsRetriever(org.infinispan.query.core.stats.impl.SearchStatsRetriever) Cache(org.infinispan.Cache) AdvancedCache(org.infinispan.AdvancedCache)

Example 20 with InternalCacheRegistry

use of org.infinispan.registry.InternalCacheRegistry in project infinispan by infinispan.

the class HotRodSingleClusteredNonLoopbackTest method testNonLoopbackPutOnProtectedCache.

public void testNonLoopbackPutOnProtectedCache(Method m) {
    InternalCacheRegistry internalCacheRegistry = manager(0).getGlobalComponentRegistry().getComponent(InternalCacheRegistry.class);
    internalCacheRegistry.registerInternalCache("MyInternalCache", hotRodCacheConfiguration().build(), EnumSet.of(InternalCacheRegistry.Flag.USER, InternalCacheRegistry.Flag.PROTECTED));
    TestResponse resp = hotRodClient.execute(0xA0, (byte) 0x01, "MyInternalCache", k(m), 0, 0, v(m), 0, (byte) 1, 0);
    assertEquals(resp.status, Success, "Status should have been 'Success' but instead was: " + resp.status);
    hotRodClient.assertPut(m);
}
Also used : TestResponse(org.infinispan.server.hotrod.test.TestResponse) InternalCacheRegistry(org.infinispan.registry.InternalCacheRegistry)

Aggregations

InternalCacheRegistry (org.infinispan.registry.InternalCacheRegistry)20 BasicComponentRegistry (org.infinispan.factories.impl.BasicComponentRegistry)5 AdvancedCache (org.infinispan.AdvancedCache)4 Cache (org.infinispan.Cache)4 GlobalConfiguration (org.infinispan.configuration.global.GlobalConfiguration)4 ConfigurationBuilder (org.infinispan.configuration.cache.ConfigurationBuilder)3 EmbeddedCacheManager (org.infinispan.manager.EmbeddedCacheManager)3 SerializationContextRegistry (org.infinispan.marshall.protostream.impl.SerializationContextRegistry)3 LocalQueryStatistics (org.infinispan.query.core.stats.impl.LocalQueryStatistics)3 AdvancedExternalizer (org.infinispan.commons.marshall.AdvancedExternalizer)2 AggregatedClassLoader (org.infinispan.commons.util.AggregatedClassLoader)2 CacheMode (org.infinispan.configuration.cache.CacheMode)2 Configuration (org.infinispan.configuration.cache.Configuration)2 GlobalComponentRegistry (org.infinispan.factories.GlobalComponentRegistry)2 ReflectionEntityNamesResolver (org.infinispan.objectfilter.impl.syntax.parser.ReflectionEntityNamesResolver)2 KeyTransformationHandler (org.infinispan.query.backend.KeyTransformationHandler)2 IndexStatistics (org.infinispan.query.core.stats.IndexStatistics)2 LocalIndexStatistics (org.infinispan.query.stats.impl.LocalIndexStatistics)2 SearchMapping (org.infinispan.search.mapper.mapping.SearchMapping)2 TestResponse (org.infinispan.server.hotrod.test.TestResponse)2