use of org.jboss.msc.Service in project wildfly by wildfly.
the class CacheGroupServiceConfigurator method build.
@Override
public ServiceBuilder<?> build(ServiceTarget target) {
ServiceName name = this.getServiceName();
ServiceBuilder<?> builder = new AsyncServiceConfigurator(name).build(target);
Consumer<Group> group = new CompositeDependency(this.cache, this.factory).register(builder).provides(name);
Service service = new FunctionalService<>(group, Functions.identity(), this, Consumers.close());
return builder.setInstance(service).setInitialMode(ServiceController.Mode.ON_DEMAND);
}
use of org.jboss.msc.Service in project wildfly by wildfly.
the class ChannelGroupServiceConfigurator method build.
@Override
public ServiceBuilder<?> build(ServiceTarget target) {
ServiceBuilder<?> builder = target.addService(this.getServiceName());
Consumer<Group> group = this.factory.register(builder).provides(this.getServiceName());
Service service = new FunctionalService<>(group, Function.identity(), this);
return builder.setInstance(service).setInitialMode(ServiceController.Mode.ON_DEMAND);
}
use of org.jboss.msc.Service in project wildfly by wildfly.
the class AffinityServiceConfigurator method build.
@Override
public ServiceBuilder<?> build(ServiceTarget target) {
ServiceName name = this.getServiceName();
ServiceBuilder<?> builder = target.addService(name);
Consumer<RouteLocatorServiceConfiguratorFactory<C>> factory = builder.provides(name);
Service service = Service.newInstance(factory, this.get());
return builder.setInstance(service).setInitialMode(ServiceController.Mode.ON_DEMAND);
}
use of org.jboss.msc.Service in project wildfly by wildfly.
the class SessionManagementServiceConfigurator method build.
@Override
public ServiceBuilder<?> build(ServiceTarget target) {
ServiceName name = this.getServiceName();
ServiceBuilder<?> builder = target.addService(name);
Consumer<DistributableSessionManagementProvider> provider = this.factory.register(builder).provides(name);
Service service = new FunctionalService<>(provider, Function.identity(), this);
return builder.setInstance(service).setInitialMode(ServiceController.Mode.ON_DEMAND);
}
use of org.jboss.msc.Service in project wildfly by wildfly.
the class CacheDependenciesProcessor method deploy.
@Override
public void deploy(DeploymentPhaseContext context) {
DeploymentUnit unit = context.getDeploymentUnit();
final ServiceName name = unit.getServiceName();
EEModuleDescription moduleDescription = unit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
if (moduleDescription == null) {
return;
}
final CapabilityServiceSupport support = unit.getAttachment(org.jboss.as.server.deployment.Attachments.CAPABILITY_SERVICE_SUPPORT);
final ServiceTarget target = context.getServiceTarget();
Set<SupplierDependency<CacheFactoryBuilder<SessionID, StatefulSessionComponentInstance>>> dependencies = new HashSet<>();
for (ComponentDescription description : moduleDescription.getComponentDescriptions()) {
if (description instanceof StatefulComponentDescription) {
StatefulComponentDescription statefulDescription = (StatefulComponentDescription) description;
dependencies.add(new ServiceSupplierDependency<>(getCacheFactoryBuilderServiceName(statefulDescription)));
}
}
Service service = new ChildTargetService(new Consumer<ServiceTarget>() {
@Override
public void accept(ServiceTarget target) {
// Cache factory builder dependencies might still contain duplicates (if referenced via alias), so ensure we collect only distinct instances.
Set<CacheFactoryBuilder<SessionID, StatefulSessionComponentInstance>> builders = new HashSet<>(dependencies.size());
for (Supplier<CacheFactoryBuilder<SessionID, StatefulSessionComponentInstance>> dependency : dependencies) {
builders.add(dependency.get());
}
for (CacheFactoryBuilder<SessionID, StatefulSessionComponentInstance> builder : builders) {
for (CapabilityServiceConfigurator configurator : builder.getDeploymentServiceConfigurators(unit)) {
configurator.configure(support).build(target).install();
}
}
}
});
ServiceBuilder<?> builder = target.addService(name.append("cache-dependencies-installer"));
for (Dependency dependency : dependencies) {
dependency.register(builder);
}
builder.setInstance(service).install();
// Install versioned marshalling configuration
new MarshallingConfigurationRepositoryServiceConfigurator(unit).build(target).setInitialMode(ServiceController.Mode.ON_DEMAND).install();
}
Aggregations