Search in sources :

Example 1 with CacheJmxRegistration

use of org.infinispan.jmx.CacheJmxRegistration 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;
}
Also used : SimpleCacheImpl(org.infinispan.cache.impl.SimpleCacheImpl) RollingUpgradeManager(org.infinispan.upgrade.RollingUpgradeManager) BasicComponentRegistry(org.infinispan.factories.impl.BasicComponentRegistry) StatsCollectingCache(org.infinispan.cache.impl.StatsCollectingCache) CacheJmxRegistration(org.infinispan.jmx.CacheJmxRegistration) AbstractDelegatingAdvancedCache(org.infinispan.cache.impl.AbstractDelegatingAdvancedCache) AdvancedCache(org.infinispan.AdvancedCache) CacheMetricsRegistration(org.infinispan.metrics.impl.CacheMetricsRegistration) Cache(org.infinispan.Cache) StatsCollectingCache(org.infinispan.cache.impl.StatsCollectingCache) AbstractDelegatingAdvancedCache(org.infinispan.cache.impl.AbstractDelegatingAdvancedCache) AdvancedCache(org.infinispan.AdvancedCache) EncoderCache(org.infinispan.cache.impl.EncoderCache)

Example 2 with CacheJmxRegistration

use of org.infinispan.jmx.CacheJmxRegistration in project infinispan by infinispan.

the class LifecycleManager method registerQueryMBeans.

/**
 * Register query statistics and mass-indexer MBeans for a cache.
 */
private void registerQueryMBeans(ComponentRegistry cr, Indexer massIndexer, InfinispanQueryStatisticsInfo stats) {
    GlobalConfiguration globalConfig = cr.getGlobalComponentRegistry().getGlobalConfiguration();
    if (globalConfig.jmx().enabled()) {
        Cache<?, ?> cache = cr.getComponent(Cache.class);
        String queryGroupName = getQueryGroupName(globalConfig.cacheManagerName(), cache.getName());
        CacheJmxRegistration jmxRegistration = cr.getComponent(CacheJmxRegistration.class);
        try {
            jmxRegistration.registerMBean(stats, queryGroupName);
        } catch (Exception e) {
            throw new CacheException("Unable to register query statistics MBean", e);
        }
        try {
            jmxRegistration.registerMBean(massIndexer, queryGroupName);
        } catch (Exception e) {
            throw new CacheException("Unable to register MassIndexer MBean", e);
        }
    }
}
Also used : GlobalConfiguration(org.infinispan.configuration.global.GlobalConfiguration) CacheJmxRegistration(org.infinispan.jmx.CacheJmxRegistration) CacheException(org.infinispan.commons.CacheException) CacheConfigurationException(org.infinispan.commons.CacheConfigurationException) CacheException(org.infinispan.commons.CacheException)

Example 3 with CacheJmxRegistration

use of org.infinispan.jmx.CacheJmxRegistration 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);
}
Also used : RollingUpgradeManager(org.infinispan.upgrade.RollingUpgradeManager) BasicComponentRegistry(org.infinispan.factories.impl.BasicComponentRegistry) BasicComponentRegistry(org.infinispan.factories.impl.BasicComponentRegistry) CacheJmxRegistration(org.infinispan.jmx.CacheJmxRegistration) RecoveryAdminOperations(org.infinispan.transaction.xa.recovery.RecoveryAdminOperations) AbstractDelegatingAdvancedCache(org.infinispan.cache.impl.AbstractDelegatingAdvancedCache) AdvancedCache(org.infinispan.AdvancedCache) CacheMetricsRegistration(org.infinispan.metrics.impl.CacheMetricsRegistration) XSiteAdminOperations(org.infinispan.xsite.XSiteAdminOperations) Cache(org.infinispan.Cache) StatsCollectingCache(org.infinispan.cache.impl.StatsCollectingCache) AbstractDelegatingAdvancedCache(org.infinispan.cache.impl.AbstractDelegatingAdvancedCache) AdvancedCache(org.infinispan.AdvancedCache) EncoderCache(org.infinispan.cache.impl.EncoderCache)

Aggregations

CacheJmxRegistration (org.infinispan.jmx.CacheJmxRegistration)3 AdvancedCache (org.infinispan.AdvancedCache)2 Cache (org.infinispan.Cache)2 AbstractDelegatingAdvancedCache (org.infinispan.cache.impl.AbstractDelegatingAdvancedCache)2 EncoderCache (org.infinispan.cache.impl.EncoderCache)2 StatsCollectingCache (org.infinispan.cache.impl.StatsCollectingCache)2 BasicComponentRegistry (org.infinispan.factories.impl.BasicComponentRegistry)2 CacheMetricsRegistration (org.infinispan.metrics.impl.CacheMetricsRegistration)2 RollingUpgradeManager (org.infinispan.upgrade.RollingUpgradeManager)2 SimpleCacheImpl (org.infinispan.cache.impl.SimpleCacheImpl)1 CacheConfigurationException (org.infinispan.commons.CacheConfigurationException)1 CacheException (org.infinispan.commons.CacheException)1 GlobalConfiguration (org.infinispan.configuration.global.GlobalConfiguration)1 RecoveryAdminOperations (org.infinispan.transaction.xa.recovery.RecoveryAdminOperations)1 XSiteAdminOperations (org.infinispan.xsite.XSiteAdminOperations)1