use of org.infinispan.factories.GlobalComponentRegistry in project radargun by radargun.
the class Infinispan60InternalsExposition method getValues.
@Override
public Map<String, Number> getValues() {
if (!service.internalsExpositionEnabled) {
return Collections.EMPTY_MAP;
}
Map<String, Number> values = new HashMap<>();
GlobalComponentRegistry globalComponentRegistry = service.cacheManager.getGlobalComponentRegistry();
addValues(findTPE(globalComponentRegistry.getComponent(KnownComponentNames.ASYNC_TRANSPORT_EXECUTOR)), "Async Transport Executor", values);
addValues(findTPE(globalComponentRegistry.getComponent(KnownComponentNames.REMOTE_COMMAND_EXECUTOR)), "Remote Commands Executor", values);
JGroupsTransport transport = (JGroupsTransport) service.cacheManager.getTransport();
if (transport != null) {
TP tp = (TP) transport.getChannel().getProtocolStack().getBottomProtocol();
addValues((ThreadPoolExecutor) tp.getOOBThreadPool(), "OOB", values);
}
return values;
}
use of org.infinispan.factories.GlobalComponentRegistry in project infinispan by infinispan.
the class ClusterRoleMapper method setContext.
@Override
public void setContext(PrincipalRoleMapperContext context) {
this.cacheManager = context.getCacheManager();
GlobalConfiguration globalConfiguration = SecurityActions.getCacheManagerConfiguration(cacheManager);
CacheMode cacheMode = globalConfiguration.isClustered() ? CacheMode.REPL_SYNC : CacheMode.LOCAL;
ConfigurationBuilder cfg = new ConfigurationBuilder();
cfg.clustering().cacheMode(cacheMode).stateTransfer().fetchInMemoryState(true).awaitInitialTransfer(false).security().authorization().disable();
GlobalComponentRegistry registry = SecurityActions.getGlobalComponentRegistry(cacheManager);
InternalCacheRegistry internalCacheRegistry = registry.getComponent(InternalCacheRegistry.class);
internalCacheRegistry.registerInternalCache(CLUSTER_ROLE_MAPPER_CACHE, cfg.build(), EnumSet.of(InternalCacheRegistry.Flag.PERSISTENT));
registry.registerComponent(this, PrincipalRoleMapper.class);
}
use of org.infinispan.factories.GlobalComponentRegistry in project infinispan by infinispan.
the class HealthImpl method getHealth.
private CacheHealth getHealth(String cacheName) {
try {
GlobalComponentRegistry gcr = SecurityActions.getGlobalComponentRegistry(embeddedCacheManager);
ComponentRegistry cr = gcr.getNamedComponentRegistry(cacheName);
if (cr == null)
return new InvalidCacheHealth(cacheName);
return new CacheHealthImpl(cr);
} catch (CacheException cacheException) {
return new InvalidCacheHealth(cacheName);
}
}
use of org.infinispan.factories.GlobalComponentRegistry in project infinispan by infinispan.
the class StartCacheFromListenerTest method testStartSameCache.
public void testStartSameCache() {
final EmbeddedCacheManager cacheManager = manager(0);
GlobalComponentRegistry registry = TestingUtil.extractGlobalComponentRegistry(cacheManager);
List<ModuleLifecycle> lifecycles = new LinkedList<>();
TestingUtil.replaceField(lifecycles, "moduleLifecycles", registry, GlobalComponentRegistry.class);
lifecycles.add(new ModuleLifecycle() {
@Override
public void cacheStarted(ComponentRegistry cr, String cacheName) {
Cache cache = cacheManager.getCache("single");
cache.put("k1", "v1");
}
});
Cache<Object, Object> some = cacheManager.getCache("single");
some.put("k2", "v2");
assertEquals("v1", cacheManager.getCache("single").get("k1"));
assertEquals("v2", cacheManager.getCache("single").get("k2"));
}
use of org.infinispan.factories.GlobalComponentRegistry in project infinispan by infinispan.
the class InfinispanRegionFactory method getCacheCommandFactory.
private CacheCommandFactory getCacheCommandFactory() {
final GlobalComponentRegistry globalCr = manager.getGlobalComponentRegistry();
final Map<Byte, ModuleCommandFactory> factories = globalCr.getComponent("org.infinispan.modules.command.factories");
for (ModuleCommandFactory factory : factories.values()) {
if (factory instanceof CacheCommandFactory) {
return (CacheCommandFactory) factory;
}
}
throw log.cannotInstallCommandFactory();
}
Aggregations