use of org.wildfly.clustering.infinispan.spi.service.TemplateConfigurationBuilder in project wildfly by wildfly.
the class ClientMappingsCacheBuilderProvider method getBuilders.
@Override
public Collection<CapabilityServiceBuilder<?>> getBuilders(ServiceNameRegistry<ClusteringCacheRequirement> registry, String containerName, String aliasCacheName) {
List<CapabilityServiceBuilder<?>> builders = new LinkedList<>();
if (aliasCacheName == null) {
String cacheName = BeanManagerFactoryBuilderConfiguration.CLIENT_MAPPINGS_CACHE_NAME;
builders.add(new TemplateConfigurationBuilder(ServiceName.parse(InfinispanCacheRequirement.CONFIGURATION.resolve(containerName, cacheName)), containerName, cacheName, aliasCacheName, builder -> {
CacheMode mode = builder.clustering().cacheMode();
builder.clustering().cacheMode(mode.isClustered() ? CacheMode.REPL_SYNC : CacheMode.LOCAL);
builder.clustering().l1().disable();
builder.persistence().clearStores();
}));
builders.add(new CacheBuilder<>(ServiceName.parse(InfinispanCacheRequirement.CACHE.resolve(containerName, cacheName)), containerName, cacheName));
ServiceNameRegistry<ClusteringCacheRequirement> routingRegistry = requirement -> ServiceName.parse(requirement.resolve(containerName, cacheName));
for (CacheBuilderProvider provider : ServiceLoader.load(this.providerClass, this.providerClass.getClassLoader())) {
builders.addAll(provider.getBuilders(routingRegistry, containerName, cacheName));
}
}
return builders;
}
use of org.wildfly.clustering.infinispan.spi.service.TemplateConfigurationBuilder in project wildfly by wildfly.
the class RouteCacheGroupBuilderProvider method getBuilders.
@Override
public Collection<CapabilityServiceBuilder<?>> getBuilders(ServiceNameRegistry<ClusteringCacheRequirement> registry, String containerName, String aliasCacheName) {
List<CapabilityServiceBuilder<?>> builders = new LinkedList<>();
if (aliasCacheName == null) {
builders.add(new TemplateConfigurationBuilder(ServiceName.parse(InfinispanCacheRequirement.CONFIGURATION.resolve(containerName, CACHE_NAME)), containerName, CACHE_NAME, aliasCacheName, builder -> {
CacheMode mode = builder.clustering().cacheMode();
builder.clustering().cacheMode(mode.isClustered() ? CacheMode.REPL_SYNC : CacheMode.LOCAL);
builder.clustering().l1().disable();
builder.persistence().clearStores();
}));
builders.add(new CacheBuilder<>(ServiceName.parse(InfinispanCacheRequirement.CACHE.resolve(containerName, CACHE_NAME)), containerName, CACHE_NAME));
ServiceNameRegistry<ClusteringCacheRequirement> routingRegistry = requirement -> ServiceName.parse(requirement.resolve(containerName, CACHE_NAME));
for (CacheBuilderProvider provider : ServiceLoader.load(this.providerClass, this.providerClass.getClassLoader())) {
builders.addAll(provider.getBuilders(routingRegistry, containerName, CACHE_NAME));
}
}
return builders;
}
use of org.wildfly.clustering.infinispan.spi.service.TemplateConfigurationBuilder in project wildfly by wildfly.
the class InfinispanBeanManagerFactoryBuilderFactory method getDeploymentBuilders.
@Override
public Collection<CapabilityServiceBuilder<?>> getDeploymentBuilders(final ServiceName name) {
String cacheName = getCacheName(name);
String containerName = this.config.getContainerName();
String templateCacheName = this.config.getCacheName();
List<CapabilityServiceBuilder<?>> builders = new ArrayList<>(4);
builders.add(new TemplateConfigurationBuilder(ServiceName.parse(InfinispanCacheRequirement.CONFIGURATION.resolve(containerName, cacheName)), containerName, cacheName, templateCacheName));
builders.add(new CacheBuilder<Object, Object>(ServiceName.parse(InfinispanCacheRequirement.CACHE.resolve(containerName, cacheName)), containerName, cacheName) {
@Override
public ServiceBuilder<Cache<Object, Object>> build(ServiceTarget target) {
return super.build(target).addDependency(name.append("marshalling"));
}
});
builders.add(new BuilderAdapter<>(new RemoveOnCancelScheduledExecutorServiceBuilder(name.append(this.name, "expiration"), EXPIRATION_THREAD_FACTORY)));
builders.add(new BuilderAdapter<>(new CachedThreadPoolExecutorServiceBuilder(name.append(this.name, "eviction"), EVICTION_THREAD_FACTORY)));
return builders;
}
Aggregations