use of org.jboss.as.clustering.controller.CapabilityServiceConfigurator in project wildfly by wildfly.
the class RegistryFactoryServiceConfiguratorProvider method getServiceConfigurators.
@Override
public Iterable<CapabilityServiceConfigurator> getServiceConfigurators(ServiceNameRegistry<ClusteringCacheRequirement> registry, String containerName, String cacheName) {
Iterable<CapabilityServiceConfigurator> configurators = super.getServiceConfigurators(registry, containerName, cacheName);
ServiceName registryServiceName = registry.getServiceName(ClusteringCacheRequirement.REGISTRY);
if (registryServiceName == null)
return configurators;
CapabilityServiceConfigurator configurator = new RegistryServiceConfigurator<>(registryServiceName, containerName, cacheName);
return new CompositeIterable<>(configurators, Collections.singleton(configurator));
}
use of org.jboss.as.clustering.controller.CapabilityServiceConfigurator in project wildfly by wildfly.
the class InfinispanSessionManagerFactoryServiceConfigurator method configure.
@Override
public ServiceConfigurator configure(CapabilityServiceSupport support) {
String containerName = this.configuration.getContainerName();
String cacheName = this.configuration.getCacheName();
String deploymentName = this.factoryConfiguration.getDeploymentName();
this.configurationConfigurator = new TemplateConfigurationServiceConfigurator(InfinispanCacheRequirement.CONFIGURATION.getServiceName(support, containerName, deploymentName), containerName, deploymentName, cacheName, this).configure(support);
this.cacheConfigurator = new CacheServiceConfigurator<>(InfinispanCacheRequirement.CACHE.getServiceName(support, containerName, deploymentName), containerName, deploymentName).configure(support);
for (CacheServiceConfiguratorProvider provider : ServiceLoader.load(DistributedCacheServiceConfiguratorProvider.class, DistributedCacheServiceConfiguratorProvider.class.getClassLoader())) {
for (CapabilityServiceConfigurator configurator : provider.getServiceConfigurators(this, this.configuration.getContainerName(), this.factoryConfiguration.getDeploymentName())) {
this.configurators.add(configurator.configure(support));
}
}
this.affinityFactory = new ServiceSupplierDependency<>(InfinispanRequirement.KEY_AFFINITY_FACTORY.getServiceName(support, containerName));
this.dispatcherFactory = new ServiceSupplierDependency<>(ClusteringRequirement.COMMAND_DISPATCHER_FACTORY.getServiceName(support, containerName));
this.group = new ServiceSupplierDependency<>(ClusteringCacheRequirement.GROUP.getServiceName(support, containerName, deploymentName));
return this;
}
use of org.jboss.as.clustering.controller.CapabilityServiceConfigurator in project wildfly by wildfly.
the class InfinispanBeanManagerFactoryServiceConfiguratorFactory method getDeploymentServiceConfigurators.
@Override
public Iterable<CapabilityServiceConfigurator> getDeploymentServiceConfigurators(final ServiceName name) {
String cacheName = getCacheName(name, this.name);
String containerName = this.config.getContainerName();
String templateCacheName = this.config.getCacheName();
// Ensure eviction and expiration are disabled
Consumer<ConfigurationBuilder> configurator = builder -> {
// Ensure expiration is not enabled on cache
ExpirationConfiguration expiration = builder.expiration().create();
if ((expiration.lifespan() >= 0) || (expiration.maxIdle() >= 0)) {
builder.expiration().lifespan(-1).maxIdle(-1);
InfinispanEjbLogger.ROOT_LOGGER.expirationDisabled(InfinispanCacheRequirement.CONFIGURATION.resolve(containerName, templateCacheName));
}
int size = this.config.getMaxSize();
EvictionStrategy strategy = (size > 0) ? EvictionStrategy.REMOVE : EvictionStrategy.MANUAL;
builder.memory().storage(StorageType.HEAP).whenFull(strategy).maxCount(size);
if (strategy.isEnabled()) {
// Only evict bean group entries
// We will cascade eviction to the associated beans
builder.addModule(DataContainerConfigurationBuilder.class).evictable(BeanGroupKey.class::isInstance);
}
};
CapabilityServiceConfigurator configurationConfigurator = new TemplateConfigurationServiceConfigurator(ServiceNameFactory.parseServiceName(InfinispanCacheRequirement.CONFIGURATION.getName()).append(containerName, cacheName), containerName, cacheName, templateCacheName, configurator);
CapabilityServiceConfigurator cacheConfigurator = new CacheServiceConfigurator<>(ServiceNameFactory.parseServiceName(InfinispanCacheRequirement.CACHE.getName()).append(containerName, cacheName), containerName, cacheName).require(new ServiceDependency(name.append("marshalling")));
List<Iterable<CapabilityServiceConfigurator>> configurators = new LinkedList<>();
configurators.add(Arrays.asList(configurationConfigurator, cacheConfigurator));
ServiceNameRegistry<ClusteringCacheRequirement> registry = new ServiceNameRegistry<ClusteringCacheRequirement>() {
@Override
public ServiceName getServiceName(ClusteringCacheRequirement requirement) {
return (requirement == ClusteringCacheRequirement.GROUP) ? ServiceNameFactory.parseServiceName(requirement.getName()).append(containerName, cacheName) : null;
}
};
for (CacheServiceConfiguratorProvider provider : ServiceLoader.load(DistributedCacheServiceConfiguratorProvider.class, DistributedCacheServiceConfiguratorProvider.class.getClassLoader())) {
configurators.add(provider.getServiceConfigurators(registry, containerName, cacheName));
}
return new CompositeIterable<>(configurators);
}
use of org.jboss.as.clustering.controller.CapabilityServiceConfigurator in project wildfly by wildfly.
the class InfinispanClientMappingsRegistryProvider method getServiceConfigurators.
@Override
public Iterable<CapabilityServiceConfigurator> getServiceConfigurators(String containerName, String connectorName, SupplierDependency<List<ClientMapping>> clientMappings) {
CapabilityServiceConfigurator configurationConfigurator = new TemplateConfigurationServiceConfigurator(ServiceNameFactory.parseServiceName(InfinispanCacheRequirement.CONFIGURATION.getName()).append(containerName, connectorName), containerName, connectorName, null, this);
CapabilityServiceConfigurator cacheConfigurator = new CacheServiceConfigurator<>(ServiceNameFactory.parseServiceName(InfinispanCacheRequirement.CACHE.getName()).append(containerName, connectorName), containerName, connectorName);
CapabilityServiceConfigurator registryEntryConfigurator = new ClientMappingsRegistryEntryServiceConfigurator(containerName, connectorName, clientMappings);
List<Iterable<CapabilityServiceConfigurator>> configurators = new LinkedList<>();
configurators.add(Arrays.asList(configurationConfigurator, cacheConfigurator, registryEntryConfigurator));
ServiceNameRegistry<ClusteringCacheRequirement> routingRegistry = new ServiceNameRegistry<ClusteringCacheRequirement>() {
@Override
public ServiceName getServiceName(ClusteringCacheRequirement requirement) {
return REGISTRY_REQUIREMENTS.contains(requirement) ? ServiceNameFactory.parseServiceName(requirement.getName()).append(containerName, connectorName) : null;
}
};
for (CacheServiceConfiguratorProvider provider : ServiceLoader.load(DistributedCacheServiceConfiguratorProvider.class, DistributedCacheServiceConfiguratorProvider.class.getClassLoader())) {
configurators.add(provider.getServiceConfigurators(routingRegistry, containerName, connectorName));
}
return new CompositeIterable<>(configurators);
}
use of org.jboss.as.clustering.controller.CapabilityServiceConfigurator in project wildfly by wildfly.
the class InfinispanSubsystemServiceHandler method installServices.
@Override
public void installServices(OperationContext context, ModelNode model) throws OperationFailedException {
InfinispanLogger.ROOT_LOGGER.activatingSubsystem();
PathAddress address = context.getCurrentAddress();
ServiceTarget target = context.getServiceTarget();
// Install local group services
ServiceNameRegistry<ClusteringRequirement> localRegistry = new CapabilityServiceNameRegistry<>(LOCAL_CLUSTERING_CAPABILITIES, address);
for (GroupServiceConfiguratorProvider provider : ServiceLoader.load(LocalGroupServiceConfiguratorProvider.class, LocalGroupServiceConfiguratorProvider.class.getClassLoader())) {
InfinispanLogger.ROOT_LOGGER.debugf("Installing %s for %s group", provider.getClass().getSimpleName(), LocalGroupServiceConfiguratorProvider.LOCAL);
for (CapabilityServiceConfigurator configurator : provider.getServiceConfigurators(localRegistry, LocalGroupServiceConfiguratorProvider.LOCAL)) {
configurator.configure(context).build(target).install();
}
}
// If JGroups subsystem is not available, install default group aliases to local group.
if (!context.hasOptionalCapability(JGroupsRequirement.CHANNEL.getDefaultRequirement().getName(), null, null)) {
ServiceNameRegistry<ClusteringRequirement> registry = new CapabilityServiceNameRegistry<>(CLUSTERING_CAPABILITIES, address);
for (IdentityGroupServiceConfiguratorProvider provider : ServiceLoader.load(IdentityGroupServiceConfiguratorProvider.class, IdentityGroupServiceConfiguratorProvider.class.getClassLoader())) {
for (CapabilityServiceConfigurator configurator : provider.getServiceConfigurators(registry, null, LocalGroupServiceConfiguratorProvider.LOCAL)) {
configurator.configure(context).build(target).install();
}
}
}
}
Aggregations