use of org.infinispan.configuration.global.GlobalConfiguration in project indy by Commonjava.
the class ContentControllerTest method setupClass.
@BeforeClass
public static void setupClass() {
GlobalConfiguration globalConfiguration = new GlobalConfigurationBuilder().globalJmxStatistics().allowDuplicateDomains(true).build();
cacheManager = new DefaultCacheManager(globalConfiguration, new ConfigurationBuilder().simpleCache(true).build());
contentMetadata = cacheManager.getCache("content-metadata", true);
}
use of org.infinispan.configuration.global.GlobalConfiguration in project wildfly by wildfly.
the class GlobalConfigurationServiceConfigurator method build.
@Override
public ServiceBuilder<?> build(ServiceTarget target) {
ServiceBuilder<?> builder = target.addService(this.getServiceName());
Consumer<GlobalConfiguration> global = new CompositeDependency(this.loader, this.modules, this.transport, this.server).register(builder).provides(this.getServiceName());
for (Dependency dependency : this.pools.values()) {
dependency.register(builder);
}
for (Dependency dependency : this.scheduledPools.values()) {
dependency.register(builder);
}
Service service = new FunctionalService<>(global, Function.identity(), this);
return builder.setInstance(service).setInitialMode(ServiceController.Mode.PASSIVE);
}
use of org.infinispan.configuration.global.GlobalConfiguration in project kernel by exoplatform.
the class ExoCacheFactoryImpl method configureCacheManager.
/**
* Configure the cache manager
*
* @param configBuilder the configuration builder on which we applied all the required changes
* @throws ExoCacheInitException
*/
private void configureCacheManager(GlobalConfigurationBuilder configBuilder) throws ExoCacheInitException {
GlobalConfiguration config = configBuilder.build();
// Configure JGroups
configureJGroups(config, configBuilder);
// Configure the name of the cache manager
configBuilder.globalJmxStatistics().enable().cacheManagerName(config.globalJmxStatistics().cacheManagerName() + "_" + ctx.getName()).mBeanServerLookup(MBEAN_SERVER_LOOKUP);
}
use of org.infinispan.configuration.global.GlobalConfiguration in project wildfly by wildfly.
the class CacheContainerBuilder method build.
@Override
public ServiceBuilder<CacheContainer> build(ServiceTarget target) {
Function<EmbeddedCacheManager, CacheContainer> mapper = manager -> new DefaultCacheContainer(this.name, manager, this.defaultCache, this.batcherFactory);
Supplier<EmbeddedCacheManager> supplier = () -> {
GlobalConfiguration config = this.configuration.getValue();
EmbeddedCacheManager manager = new DefaultCacheManager(config, null, false);
manager.addListener(this);
manager.start();
InfinispanLogger.ROOT_LOGGER.debugf("%s cache container started", this.name);
return manager;
};
Consumer<EmbeddedCacheManager> destroyer = manager -> {
manager.stop();
manager.removeListener(this);
InfinispanLogger.ROOT_LOGGER.debugf("%s cache container stopped", this.name);
};
Service<CacheContainer> service = new SuppliedValueService<>(mapper, supplier, destroyer);
ServiceBuilder<CacheContainer> builder = target.addService(this.getServiceName(), service).addAliases(this.aliases.stream().toArray(ServiceName[]::new)).setInitialMode(ServiceController.Mode.PASSIVE);
return this.configuration.register(builder);
}
use of org.infinispan.configuration.global.GlobalConfiguration in project wildfly by wildfly.
the class CacheContainerServiceConfigurator method get.
@Override
public EmbeddedCacheManager get() {
GlobalConfiguration config = this.configuration.get();
String defaultCacheName = config.defaultCacheName().orElse(null);
ConfigurationBuilderHolder holder = new ConfigurationBuilderHolder(config.classLoader(), new GlobalConfigurationBuilder().read(config));
// We need to create a dummy default configuration if cache has a default cache
if (defaultCacheName != null) {
holder.newConfigurationBuilder(defaultCacheName);
}
EmbeddedCacheManager manager = new DefaultCacheManager(holder, false);
// Undefine the default cache, if we defined one
if (defaultCacheName != null) {
manager.undefineConfiguration(defaultCacheName);
}
manager.start();
// Must create executor before registering cache listener
this.executor = Executors.newSingleThreadExecutor(new DefaultThreadFactory(this.getClass()));
manager.addListener(this);
InfinispanLogger.ROOT_LOGGER.debugf("%s cache container started", this.name);
return manager;
}
Aggregations