use of org.infinispan.metrics.impl.CacheMetricsRegistration in project infinispan by infinispan.
the class InternalCacheFactory method createSimpleCache.
private AdvancedCache<K, V> createSimpleCache(Configuration configuration, GlobalComponentRegistry globalComponentRegistry, String cacheName) {
AdvancedCache<K, V> cache;
if (configuration.statistics().available()) {
cache = buildEncodingCache(new StatsCollectingCache<>(cacheName));
} else {
cache = buildEncodingCache(new SimpleCacheImpl<>(cacheName));
}
componentRegistry = new SimpleComponentRegistry<>(cacheName, configuration, cache, globalComponentRegistry);
basicComponentRegistry = componentRegistry.getComponent(BasicComponentRegistry.class);
basicComponentRegistry.registerAlias(Cache.class.getName(), AdvancedCache.class.getName(), AdvancedCache.class);
basicComponentRegistry.registerComponent(AdvancedCache.class, cache, false);
componentRegistry.registerComponent(new CacheJmxRegistration(), CacheJmxRegistration.class);
componentRegistry.registerComponent(new CacheMetricsRegistration(), CacheMetricsRegistration.class);
componentRegistry.registerComponent(new RollingUpgradeManager(), RollingUpgradeManager.class);
return cache;
}
use of org.infinispan.metrics.impl.CacheMetricsRegistration in project infinispan by infinispan.
the class InternalCacheFactory method bootstrap.
/**
* Bootstraps this factory with a Configuration and a ComponentRegistry.
*/
private void bootstrap(String cacheName, AdvancedCache<?, ?> cache, Configuration configuration, GlobalComponentRegistry globalComponentRegistry, StreamingMarshaller globalMarshaller) {
// injection bootstrap stuff
componentRegistry = new ComponentRegistry(cacheName, configuration, cache, globalComponentRegistry, globalComponentRegistry.getClassLoader());
/*
--------------------------------------------------------------------------------------------------------------
This is where the bootstrap really happens. Registering the cache in the component registry will cause
the component registry to look at the cache's @Inject methods, and construct various components and their
dependencies, in turn.
--------------------------------------------------------------------------------------------------------------
*/
basicComponentRegistry = componentRegistry.getComponent(BasicComponentRegistry.class);
basicComponentRegistry.registerAlias(Cache.class.getName(), AdvancedCache.class.getName(), AdvancedCache.class);
basicComponentRegistry.registerComponent(AdvancedCache.class.getName(), cache, false);
componentRegistry.registerComponent(new CacheJmxRegistration(), CacheJmxRegistration.class.getName(), true);
componentRegistry.registerComponent(new CacheMetricsRegistration(), CacheMetricsRegistration.class.getName(), true);
if (configuration.transaction().recovery().enabled()) {
componentRegistry.registerComponent(new RecoveryAdminOperations(), RecoveryAdminOperations.class.getName(), true);
}
if (configuration.sites().hasBackups()) {
componentRegistry.registerComponent(new XSiteAdminOperations(), XSiteAdminOperations.class.getName(), true);
}
// The RollingUpgradeManager should always be added so it is registered in JMX.
componentRegistry.registerComponent(new RollingUpgradeManager(), RollingUpgradeManager.class.getName(), true);
}
Aggregations